Conditional Notification Emails on Form Submission

John Walter asked on October 9, 2015 17:30

I am trying to get the notification emails to submit based off of the entries of a form. I have tried two techniques and neither seem to work:

{% x = {%QueryString.whose%}; if (x>"1") {"test@email.com"} else {"test2@email.com"} %}

In this technique it seems to resolve the querystring value and then the rest is retained as just text instead of resolving the entire macro.

{% if (Email2 == "2") { 

return "test@gmail.com" } else { return "test2@gmail.com" } %}

In this one, it just fails.

Anyone have any ideas for this?

I currently have it working by having a hidden field which takes the value from a querystring and then I have the "to e-mail" set to the value of that hidden field. This works, however I am looking for a way to not have to have the email address shown in the url & link.

Thanks in advance!

Correct Answer

Roman Hutnyk answered on October 9, 2015 20:11

John,

{% x = {%QueryString.whose%}; if (x>"1") {"test@email.com"} else {"test2@email.com"} %}

There is an error macro braces inside of other macro braces. This should look like:

{% x = QueryString.whose; if (x>"1") {"test@email.com"} else {"test2@email.com"} %}

Second one seems to be correct, except you have to make sure there is a fields Email2 in your form. You might also miss return:

{% if (Email2 == "2") { "bfarkas@iona.edu" } else { "bfarkas1@gaels.iona.edu" } %}

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.