Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/13/2024 04:49 PM
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).
05/13/2024 08:08 PM
05/13/2024 08:16 PM
@rushikeshvartak this is attached at endpoint to trigger at task completion for Add access
05/13/2024 08:20 PM
<%if(task?.entitlement_valueKey?.entitlement_value=null && task?.entitlement_valueKey?.entitlementTypekey=='Ticket') print "test@abc.com" else print "testing@abc.com" %>
05/14/2024 04:35 AM
@SUMAIYA_BABU try below
<%if(task?.entitlement_values==null && task?.entitlement_values?.entitlementtypekey=='Ticket') print "test@abc.com" else print "testing@abc.com" %>
05/14/2024 05:19 AM
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.
05/14/2024 06:41 AM
@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.
05/14/2024 08:05 PM
<%if(task?.entitlement_valueKey?.entitlementtypekey !=null && task?.entitlement_valueKey?.entitlementtypekey?.displayname=='Profile') print "test@abc.com" else print "testing@abc.com" %>