cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to hide empty values in email templates

How to hide empty values in email templates

Often, in an email template, you want to print something like:

 

Division: Finance

Location: Austin

Comments: These are comments important to your knowledge of what just happened....

 

 

If the comments variable happens to be empty, you get this:

 

Division: Finance

Location: Austin

Comments: $comments

 

Many users will want to print nothing for an empty variable. In this case, you can do the following:

 

Since we use Apache Velocity (http://velocity.apache.org/) to render our email templates, you can use any Velocity feature in your email templates.

 

In Velocity, you can add an If statement around your comments field, so that an empty comments variable will result in nothing being printed out like so:

 

#if ($comments)

Comments: $comments

#end

 

Now, the results would look like so:

 

Division: Finance

Location: Austin

 

For more on Email Templates and Apache Velocity, see here: Email Template Usage and Customization.pdf and here: http://velocity.apache.org/engine/devel/vtl-reference-guide.html

 

Note: As of Identity IQ 6.1, we use Apache Velocity Version 1.5.

Labels (1)
Version history
Revision #:
2 of 2
Last update:
‎Jun 12, 2023 10:45 PM
Updated by:
 
Contributors