Jump to content
  • 0

Is it possible to send a different email message on form submission based on field value?



I have a datapage that allows a user to submit either a Yes or No on whether they are willing to volunteer for something. While I can currently send them a simple acknowledgement that contains their response, I want to send a different email if they answer Yes vs. No. 

Is this possible?


Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

You could probably do this with Triggers instead of Acknowledgment Emails.

Create an Update Trigger (or insert). Add an IF/THEN block, click on the Settings for the block and enable 'ELSE'. For the condition, put 'IF field_value = Yes'. In the THEN section, put an email block for the Yes version of the email. In the ELSE section, put an email block for the No version of the email.

The user will only receive one email depending on the value of the Yes/No field.

Link to comment
Share on other sites

  • 0

Another way... include a Calculated Field in the datapage where the user selects Yes or No. Write a CASE statement in this calcfield, and include the message body of both versions of the email, like so:

  WHEN [@field:] = "YES"
  THEN "This will be the yes version of the email message body."
  ELSE "This will be the no version of the email message body."

Then, in the Acknowledgement Email Message Body, use the Field Picker to add the calculated field. Now the email will state whatever the Calc Field produces, which should be dynamic depending on the value selected for your Yes/No field. 

Then just hide the calc field from the datapage so the user can't see it.

Link to comment
Share on other sites

  • 0

Thank you @kpcollier!

I sat on one of Ned's recent live sessions and he shared his thought on this of using a trigger to send the email. That works great for a newly added (inserted) record. But I need this to work for a record being updated so I'll probably try your Calculated Field suggestion above and see how that works.


Ned's sample trigger:


Link to comment
Share on other sites

  • 0

I'm sure you can do it with an update trigger too, if you wanted to stay that route. 

What you can do is in the SELECT Block, go to the Settings and enable JOIN. Join the table to itself, so you'll query the same record from the table AND from #inserted. Just match the fields on ID. 

Then, in the WHERE clause, set it where #inserted.YesNoField = Yes and YourTable.YesNoField is blank. Do the same thing for another email block but swap the Yes/No values.

This makes it so the update email is sent only when that field is updated. If any other part of the record is updated without updating the YesNoField, the email won't send. 

Something like this.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...