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

Filter New Joiner Email by EmployeeClass

Mahendran
New Contributor III
New Contributor III

Filter New Joiner Email by EmployeeClass
Our requirement is to filter email for new joiners based on their EmployeeClass which can either be 'Employee' or 'Contractor'. we have added the email template under AD endpoint.
But Email is not getting triggered when we use the below query for new joiner as Email in the 'TO' section of email

 

TO: ${if(users?.EmployeeClass.equalsIgnoreCase('Employee')){user.email} else{manager.email}}

also tried many combinations

TO:${if(user?.employeeClass.equalsIgnoreCase('Employee')){user.email} else{manager.email}}

 

if EmployeeClass is 'Contractor'

then Email should be sent to the new users manager 

else if EmployeeClass is 'Employee'

then Email should be sent to the new user itself

is something incorrect or missing in the query? the email is getting triggered when we hardcode the 'TO' to our own email address

Thanks

3 REPLIES 3

adarshk
Saviynt Employee
Saviynt Employee

Please refer the below article and built the script to add in email template 'TO' section.

https://forums.saviynt.com/t5/saviynt-knowledge-base/how-to-send-different-emails-with-if-else-condi...

 

Mahendran
New Contributor III
New Contributor III

is it possible even if the attribute which we want to filter against is not present in the binding variables, as task type is present in binding variable but we are trying to filter by employeeclass which is not working with this query: <% if (user?.employeeclass == 'Employee') print "${manager?.email}" else if (user?.employeeclass == 'Contractor') print "${xxx@gmail.com}"%>'

if this is wrong syntax or is it possible to filter using employeeclass attribute

To get what variables are present to use in the email template, check using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:


${this.binding.variables.each {k,v -> println "$k = $v" + "" + "br" + ">"}}


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