APIs & Integrations

Manobyte
Contributor | Diamond Partner
Contributor | Diamond Partner

Creating hubl form with notifications override from HubDB entry

SOLVE

I created an employees page using HubDB and a custom module with a for loop to create the listing. The custom module has a field for the form but I customized it with the widget_block so I could edit the notifications_override_email_addresses. It is set up so that each employee gets a form and I would like it to email said employee when their form is filled out.

Now, the code works just fine when I use a static email in it, but when I try to use the row.email it does not send the notification email. I did use the row.hs_id for the form id to make sure each form had a unique id, so it is pulling information from the database into the forms creation. I also triple checked that row.email and its entry in the database where all spelled correctly. If anyone has some insight on this I would appreciate it. my code is below.

{% widget_block form row.hs_id, form_follow_ups_follow_up_type='', response_redirect_id=module.form_field.redirect_id, form_to_use='{{ module.form_field.form_id }}', title='', notifications_are_overridden=True, sfdc_campaign='', response_message='{{ module.form_field.message }}', response_response_type='{{ module.form_field.response_type }}', response_redirect_url='{{module.form_field.redirect_url}}', overrideable=True, gotowebinar_webinar_key='', response_redirect_name='Homepage (http://www.hubspot.com/)', label='Form', response={message='{ module.form_field.message }}', redirect_url='{{module.form_field.redirect_url}}'}  %}

     {% widget_attribute "notifications_override_email_addresses" is_json=True %}["{{ row.email }}"]{% end_widget_attribute %}

{% end_widget_block %}

I would like to add that I also tried to remove the json=True and add only the email as suggested in this post

A couple things: you shouldn’t set your widget_block inside the for loop… {% widget_block form "form_contact_reseau"... since the HUBL module will be attempting to set the same ID form_contact_reseau for each widget block which would be a duplicate. I just tested this code so it should work… if you remove is_json=“true” - you can just pass a string with comma separated values {% text "id_form" label='Id formulaire contact (1 pour chaque langue)', value='3f2b3ff8-693b-43b4-845c-b3b200908…

but this did not work for me either, not even using a static email rather then a hubl token.

Update:

I also tried making a single form not in a loop but using a hubl token for the email which did not work either, it seems like hubl tokens dont work in the widget_attribute.
{% set send_email= 'email@email.com' %}
{% widget_block form 'fop', form_follow_ups_follow_up_type='', response_redirect_id=module.form_field.redirect_id, form_to_use='e75096de-a2f8-4683-bdc7-78368942be02', title='', notifications_are_overridden=True, response_message='thanks', overrideable=True, label='Form'}  %}
   {% widget_attribute "notifications_override_email_addresses" is_json=True %}["{{ send_email }}"]{% end_widget_attribute %}
{% end_widget_block %}
0 Upvotes
1 Accepted solution
Manobyte
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Creating hubl form with notifications override from HubDB entry

SOLVE

To anyone who finds this and has a similar problem, I found a solution. While I cant seem to put hubl in the widget_attribute I can turn the whole thing into a token and place that inside the widget_block, like this;

{% set email_attribute = '{% widget_attribute "notifications_override_email_addresses" is_json=True %}["'~ row.email ~'"]{% end_widget_attribute %}' %}
{% widget_block form row.hs_id, form_follow_ups_follow_up_type='', response_redirect_id=module.form_field.redirect_id, form_to_use='{{ module.form_field.form_id }}', title='{{ row.name }}', notifications_are_overridden=True, response_message='{{ module.form_field.message }}', response_response_type='{{ module.form_field.response_type }}', response_redirect_url='{{module.form_field.redirect_url}}', overrideable=True, label='Form', response={message='{ module.form_field.message }}', redirect_url='{{module.form_field.redirect_url}}'}  %}
      {{ email_attribute }}
{% end_widget_block %}

View solution in original post

1 Reply 1
Manobyte
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Creating hubl form with notifications override from HubDB entry

SOLVE

To anyone who finds this and has a similar problem, I found a solution. While I cant seem to put hubl in the widget_attribute I can turn the whole thing into a token and place that inside the widget_block, like this;

{% set email_attribute = '{% widget_attribute "notifications_override_email_addresses" is_json=True %}["'~ row.email ~'"]{% end_widget_attribute %}' %}
{% widget_block form row.hs_id, form_follow_ups_follow_up_type='', response_redirect_id=module.form_field.redirect_id, form_to_use='{{ module.form_field.form_id }}', title='{{ row.name }}', notifications_are_overridden=True, response_message='{{ module.form_field.message }}', response_response_type='{{ module.form_field.response_type }}', response_redirect_url='{{module.form_field.redirect_url}}', overrideable=True, label='Form', response={message='{ module.form_field.message }}', redirect_url='{{module.form_field.redirect_url}}'}  %}
      {{ email_attribute }}
{% end_widget_block %}