using "Contains()" in email template

Joon
New Contributor III
New Contributor III

Hello All,

I am trying to use "contains" in email template like below, but it seems wrong since i got no email when I use this function. can you give me an advice to improve ?

Below are what I have tried but not worked

<% if(${task?.taskdate}.contains('07:'))" print "hello" else print "Bye" %>

<% if((${task?.taskdate}).contains('07:'))" print "hello" else print "Bye" %>

13 REPLIES 13

rushikeshvartak
All-Star
All-Star

 

<% if(task?.taskdate.contains('07:')) print "Hello" else print "BYE" %>

 

Joon
New Contributor III
New Contributor III

Thanks for your response! but unfortunately, it doesn't work for me ..

<%if (task.taskdate.contains('07:')) print "HELLO" else print "BYE" %>

Which mail template are you testing 

below should work 

 

<%if (1=1) print "HELLO" else print "BYE" %>

Joon
New Contributor III
New Contributor III

I work on the template for endpoint level. doesn't it require "$" to use binding variables ?

 

What is email trigger point ? Task creation / Request Approval ?

Joon
New Contributor III
New Contributor III

it's triggered when task completed for remove access

Joon
New Contributor III
New Contributor III

<% if ("${task?.source}" == "CERTIFICATION") print "HELLO" else print "BYE" %>

This one works properly. but i'm not sure where to put "contains" in the statement

<% if ("${task?.source?.contains("CERTIFICATION")} print "HELLO" else print "BYE" %>

Joon
New Contributor III
New Contributor III

Thanks for the prompt answer! I really appreciate it.

but It still won't be working with "contains"...😢

Share screenshot on email Template and output 

Joon
New Contributor III
New Contributor III

Below is what i tried as per your suggestion but couldn't get an email.

12.png

${task?.taskdate}<br><% if ("${task?.taskdate?.contains('07:')}" print "HELLO" else print "BYE" %>

 

but I will get the output like below If I would go with only ${task?taskdate}

13.png

 

<%if(task.taskdate.toString().contains('07:')){print "Hello Joon"} else {print "Bye Joon"}%>

Hide Confidential Info

Joon
New Contributor III
New Contributor III

I really appreciate it. It finally works !!