Hooks allows us to create custom email notifications that are sent to the customer upon form submission. In this example we will create a hook that will send a email to the customer that includes a PDF guide for them to download.
Navigate to Orchestration > List and click Add Job to add a new job to the existing list. (This section was previously called Automations > Hooks; a job is still a hook.)
Add Name & Description to the new job, this will also display on the Orchestration list page
Open the Triggers tab and configure the “Entity Event Triggers”:
Entity: Form Submission
Method: Completed
Parent Form: the form this autoresponder is for
Setting Parent Form scopes the hook to a single form, so it only runs for submissions of that form. This is the cleanest way to restrict a form hook, and it replaces the Template condition that earlier versions of this guide used to compare the form ID. If all you need is “only this form”, you can skip the condition below and go straight to Add Action.
Save the Job
Upon save you will be redirected to the “Actions” page in the admin where conditions and actions can be configured. Actions can also be accessed via the List page.
For this example we need to configure the following:
“Add Action” - to send the email to the customer
“Add Condition” (optional) - only needed to filter on something other than which form was submitted
The final setup will look like below:
The example below still configures a condition, because conditions remain useful for filtering on anything other than which form was submitted — a particular field value, for instance. When a condition is used, it is configured first and the action is configured within it.
Add Condition (optional)
Add description to the condition, this will also be displayed in the action area in the admin as per the previous screenshot
Choose Condition Type = Template and add the following:
The above code snippet ensures the email notification is only sent to customers that complete the form that has id = 7.
You no longer need a condition just to restrict a hook to one form: set Parent Form on the Entity Event Trigger instead, as described above. A Template condition is still the right tool for any other kind of filtering.
Form ID can be retrieved from the Forms module. Hover over the ‘edit’ pencil and check the link at the bottom of the page:
Click Save to save the condition
Add Action
Now navigate back to the actions and add a new action under the created condition. Actions can be accessed via the Orchestration > List page:
Add a new action by clicking on the “Add Action” link under the created condition
Choose the “Send Email” action
Configure the action:
Add description
Unique Identifier
Set “Sender” - the name and address the email is sent from, for example Core dna <noreply@example.com>
Set “Recipients” - one recipient per line, as Name <email>
Set “Subject”
Set “Template file” from your BitBucket Repository or use the below “Template code” area
In order to send the email directly to the customer who submitted the form, set “Recipients” to pull the customer’s name and email address from the submitted form:
The last step is to enable the Job with the Published switch in the main Orchestration > List area:
All form submissions can be viewed in the Interactions > Forms > Form Submissions area in the admin, while all sent emails can be viewed in the Interactions > Mailer > Emails area in the admin.