Search code examples
macroskentico

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.


Solution

    • 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; } %}