01-30-2023 08:55 PM
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 ?
Solved! Go to Solution.
01-30-2023 09:13 PM
Yes
01-30-2023 09:14 PM
How to put the logic ? Can you give me sample
01-30-2023 09:30 PM
<% if (user.secondaryManager) print "${user.secondaryManager.email}" else print "${manager.email}" %>
01-31-2023 09:55 AM - edited 01-31-2023 09:56 AM
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 "" %>
01-31-2023 10:02 AM - edited 01-31-2023 12:50 PM
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 "" %>
01-31-2023 10:23 AM - edited 01-31-2023 10:23 AM
01-31-2023 11:01 AM
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" + ">"}}
01-31-2023 02:39 PM
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
01-31-2023 02:48 PM - edited 01-31-2023 02:50 PM
<% 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 "" %>
01-31-2023 03:04 PM
Enable below setting in global configuration to send emails on Task completion as part of Disable Account
Email for Disable Account Task Completion
01-31-2023 11:39 AM
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 "" %>
01-31-2023 03:46 PM
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 "" %>