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|(user)zbynekh|(hash)99e14ce3f3e981521002bd7a49e31c3dde2b5302c9013c01101dd9dabf15341e%}; 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"} |(user)zbynekh|(hash)1ec0a08dee2d15899d2b51138e2500f16bc833ac054746e7ae87a8f7c0c8c810%}

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" } |(user)zbynekh|(hash)8db462b5ad71b61aea6e5bec9f20c0daf9127708f26c00d6480d5e10d3d20bf3%}

1 votesVote for this answer Unmark Correct answer

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