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

Sent an email based on entitlement Type

SUMAIYA_BABU
Regular Contributor
Regular Contributor

 

I am trying to access the variable ${task?.entitlement_valueKey?.entitlement_value} in the TO address part of an email template to restrict the sending of email based on the entitlement type of the task as below:

<%if(task?.entitlement_valueKey?.entitlement_value=null && task?.entitlement_valueKey?.entitlementtypekey=='Ticket') print "test@abc.com" else print "testing@abc.com" %>

But the validation is always going to the else part of the email. 

 

Tried printing the variable in the body part of the same email to ensure the value of the variable and the variable is displaying the entitlementtype value ('Ticket' in this case).

 

7 REPLIES 7

rushikeshvartak
All-Star
All-Star
  • Please confirm where is email template is attached ?

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

@rushikeshvartak this is attached at endpoint to trigger at task completion for Add access

<%if(task?.entitlement_valueKey?.entitlement_value=null && task?.entitlement_valueKey?.entitlementTypekey=='Ticket') print "test@abc.com" else print "testing@abc.com" %>


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

Raghu
Valued Contributor III
Valued Contributor III

@SUMAIYA_BABU  try below

<%if(task?.entitlement_values==null && task?.entitlement_values?.entitlementtypekey=='Ticket') print "test@abc.com" else print "testing@abc.com" %>


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

itinjic
Regular Contributor
Regular Contributor

It appears that there is an issue with the comparison in your if condition. You are using a single equal sign (=) instead of double equal signs (==) for the comparison operator. This is causing the condition to always evaluate to false, resulting in the else part of the email being executed.

To fix this issue, you need to update your if condition as follows:

<% if (task?.entitlement_valueKey?.entitlement_value == null && task?.entitlement_valueKey?.entitlementtypekey == 'Ticket') print "test@abc.com" else print "testing@abc.com" %>

By using double equal signs (==), you are comparing the values of the variables instead of assigning a value to the variables.

Once you make this change, the if condition should correctly evaluate the entitlementtypekey value and send the email to the appropriate address based on the condition.

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

SUMAIYA_BABU
Regular Contributor
Regular Contributor

@itinjic I have tried the same - but this always evaluates to false. 

@Raghu  @rushikeshvartak Below is the condition I am using

<%if(task?.entitlement_valueKey?.entitlementtypekey !=null && task?.entitlement_valueKey?.entitlementtypekey=='Profile') print "test@abc.com" else print "testing@abc.com" %>

 

 

task?.entitlement_values is not working - it throws an error. I tried to evaluate with task?.entitlement_valueKey?.entitlement_value='<ent_name>' in the 'TO' field and thats working as expected and evaluates to true. 

task?.entitlement_valueKey?.entitlementtypekey prints the expected value in the body , but the evaluation is incorrect.

 

 

 

<%if(task?.entitlement_valueKey?.entitlementtypekey !=null && task?.entitlement_valueKey?.entitlementtypekey?.displayname=='Profile') print "test@abc.com" else print "testing@abc.com" %>

 


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