PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

Syntax for email template body

Bhargav
New Contributor
New Contributor

Hi Team,

We are trying to print request attributes in email template from the form. we need right syntax to use it email template subject. We are using the below conditions

if (request?.requesttype == 18) New Joiner Request ${requestid} has been rejected.
else if (request?.requesttype == 19 and if customproperty44 contains Leaver) then Leaver Request ${requestid} has been rejected.
if (request?.requesttype == 19 and if customproperty44 contains Mover) then Mover Request ${requestid} has been rejected.
if (request?.requesttype == 19 and if customproperty44 contains Update) then User Update Request ${requestid} has been rejected.

The Customproperty44 is taken from request attributes and also we tried below condition but it shows syntax error

<% if (request?.requesttype == 18) print "New Joiner Request ${requestid} has been rejected." else if ((request?.requesttype == 19 && ${accessItems.collect{ it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('customproperty44')}.collect{it.attributeValue}}.get(0).join(', ')}.contains('Leaver')) print "Leaver Request ${requestid} has been rejected."  %>

Can someone help me with right syntax?

8 REPLIES 8

Saathvik
All-Star
All-Star

@Bhargav : Are you talking about Workflow emails or task emails? If it is workflow email try below

<% if (request?.requesttype == 18) print "New Joiner Request ${requestid} has been rejected." else if (request?.requesttype == 19 && ((accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('customproperty44')}.collect{it.attributeValue}}).contains('Leaver'))) print "Leaver Request ${requestid} has been rejected." %>

Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

Hi Sk,

yes it's for workflow emails only.

And the above condition shows syntax error.

@Bhargav : What is the error you are seeing with the variable I shared?


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

Hi Sk,

The template is not getting saved, and getting below error.

Bhargav_0-1697135433053.png

 

@Bhargav : Did you enable Advanced HTML CSS and Content As HTML? If not can you do the same and try

sk_0-1697143483049.png

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

stalluri
Valued Contributor
Valued Contributor

@Bhargav 

There is a syntax error in the condition.

<% if (request?.requesttype == 18) print "New Joiner Request ${requestid} has been rejected." else if ((request?.requesttype == 19) && ${accessItems.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('customproperty44')}.collect{it.attributeValue}}.get(0).join(', ')}.contains('Leaver')) print "Leaver Request ${requestid} has been rejected." %>




Best Regards,
Sam Talluri
If you find this a helpful response, kindly consider selecting Accept As Solution and clicking on the kudos button.

can you help me out on this?

Manu269
All-Star
All-Star

Hi @Bhargav 

can you try below expressions in your email template. 
${request.requesttype} 

In case above not worked then try ${requesttype}  

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.