End point - Task Completion email - send only if condition match

IAM_99
Regular Contributor II
Regular Contributor II

Hi Team,

We have an Email configured at End point level  on Task Complete , Can we send email if some condition matches

for ex:

if ( null!=cp1 && cp1='Active' )  {  send Email  }  else No email

Can we do this ?

12 REPLIES 12

rushikeshvartak
All-Star
All-Star

Yes

IAM_99
Regular Contributor II
Regular Contributor II

How to put the logic ? Can you give me sample

<% if (user.secondaryManager) print "${user.secondaryManager.email}" else print "${manager.email}" %>

IAM_99
Regular Contributor II
Regular Contributor II

Can you see below whats wrong with this we are not getting email ( this is from To email)

 

<% if (!user.secondaryManager && user.customproperty51=='0' && arsTasks.taskType == '14' ) print "${manager?.email}" else if(user.secondaryManager!=null && user.customproperty51=='0' && arsTasks.taskType == '14') print "${user.secondaryManager.email}" else print "" %>

what is error are you getting try testing in email body

<% if (!user.secondaryManager && user.customproperty51=='0' && task?.tasktype == '14' ) print "${manager?.email}" else if(user.secondaryManager!=null && user.customproperty51=='0' && task?.tasktype == '14') print "${user.secondaryManager.email}" else print "" %>

IAM_99
Regular Contributor II
Regular Contributor II

tried above no luck , PFA Logs , not able to find anything related. This is email template name - "Email notification after 30 day disable due to inactivity"

where is email template attach. Are you getting email if you hardcode email in TO and did u tried in email body ?

share output of below from email body

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

IAM_99
Regular Contributor II
Regular Contributor II

this is the out put below 

request = null
task = com.saviynt.ecm.task.ArsTasks : 72184
tasktype = Disable Account
manager = Exxxxx
endpointDisplayName = Active Directory
baseUrlForEmail = https://release-n-plus-one.saviyntcloud.com/ECM
user = EJMLET19
taskaction = Disable Account
requestor = admin
tasks = com.saviynt.ecm.task.ArsTasks : 72184
users = Exxxxx19
out = java.io.PrintWriter@114a3e05.

We are calling this in End point - found another challenge - Its only triggering only Disable account - Task Create but not on Task Complete 

<% if (!user.secondaryManager && user.customproperty51=='0' && tasktype.equalsIgnoreCase('Disable Account' ))print "${manager?.email}" else if(user.secondaryManager!=null && user.customproperty51=='0' &&tasktype.equalsIgnoreCase('Disable Account' )) print "${user.secondaryManager.email}" else print "" %>

Enable below setting in global configuration to send emails on Task completion as part of Disable Account

Email for Disable Account Task Completion

 

sk_0-1675206191987.png

 


Regards,
Saathvik

Try below

<% if (!user.secondaryManager && user.customproperty51=='0' && task?.tasktype == '14' ) print "${manager?.email}" else if(user.secondaryManager!=null && user.customproperty51=='0' && task?.tasktype == '14') print "${user.secondaryManager.email}" else print "" %>


Regards,
Saathvik

IAM_99
Regular Contributor II
Regular Contributor II

yes this worked and Global setting for  Disable Account Email.

<% if (!user.secondaryManager && user.customproperty51=='0' && task?.tasktype == 14 ) print "${manager?.email}" else if(user.secondaryManager!=null && user.customproperty51=='0' && task?.tasktype == 14) print "${user.secondaryManager.email}" else print "" %>