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

How to put condition in subject of mail

Harsha
Regular Contributor II
Regular Contributor II

Hi,

For new joiner Active Directory creation based on one of customproperty subject of the mail should be changed. Can anyone help how this can be achieved I tried adding 

Subject:${if(user?.customproperty30='xxx'){'yyy New Joiner Details'} else{'zzz New Joiner Details'}}

but log says  -Error while sending email - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:

Thank you

7 REPLIES 7

DaanishJawed
Saviynt Employee
Saviynt Employee

Hi,

Can you try with the below syntax in the SUBJECT field of the email template?

 

<% if(user?.customproperty30 == "xxx") print "yyy New Joiner Details" else print "zzz New Joiner Details" %>

 

Thanks.

Harsha
Regular Contributor II
Regular Contributor II

Hello,

Thank you for quick reply. I have tried that didnt work its giving blank subject. Is there any other way?

Harsha
Regular Contributor II
Regular Contributor II

Hello, 

I have one more question if I want to put same logic in body will it work? 

Hi,

Below is working for me when task complete email goes out for New Account.

Screenshot 2023-02-08 at 1.33.31 AM.png

Looks like there are other conditions in your email template (in TO/CC field) which might be causing issues. Can you try with a simple email template as above to validate the condition?

Thanks.

Harsha
Regular Contributor II
Regular Contributor II

Hello,

Yes you are right I had other conditions. And above solution is working in both subject and body. Thank you.

Which email template are you trying and when its getting trigger ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi Rushikesh,

They are using the Endpoint Level Email Templates where the mail triggers when the New Account Task completes.

Thanks.