Vicky
Vicky

Reputation: 358

use macro if condition in email notification

I am using a macro for if condition to check if a field is null or not, in a form email notification. I tried this one:

{% if(City != string.Empty) { $$value:City$$ } #%}

It did not work, and I am not getting the city value in the email body.

Upvotes: 1

Views: 663

Answers (1)

Kristian Bortnik
Kristian Bortnik

Reputation: 838

  • Use {%City%} instead of $$value:City$$
  • If you're simply not going to render the value of the "City" field if it's empty, you might as well just replace the whole block of code with just {%City%}
  • Assuming your code is just a simplified example of what you are trying to accomplish, it should look like this:
    {% if(City != string.Empty) { return City; } %}

Upvotes: 4

Related Questions