Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

If-else condition in Workflow Email Templates

New Contributor
New Contributor
Hi Team
We are sending an email to Approver about Requested Roles or Entitlement from a Workflow and need to write if-else condition for roles and entitlement's request.
If we used the below expressions in the if-else block ,Email is not triggering but If we doesn't use below expressions in the if-else block, the value is printing fine in the email.
<% if (\"${accessItems.collect{it.accesstype}[0]}\" == \"2\") {"Hi ent"} else {"Hi  Roles part"} %>
<% if (${accessItems.collect{it.accesstype}[0]} == 2) { print "Hi ent "} else if (${accessItems.collect{it.accesstype}[0]} == 7) {print "Hi role "} else {} %>
Please find the attached screenshots  and help me on this expression in the Email template.
Sumalatha Markanti

Saviynt Employee
Saviynt Employee

Hello @sumalatham,

Here are some possible corrections to your expressions you may try:
<% if ("${accessItems.collect{it.accesstype}[0]}" == "2") { "Hi ent" } else { "Hi Roles part" } %> 


<% if (${accessItems.collect{it.accesstype}[0]} == 2) { "Hi ent" } else if (${accessItems.collect{it.accesstype}[0]} == 7) { "Hi role" } else { "" } %>

For Ref:- 

If you find the above response useful, Kindly Mark it as "Accept As Solution".