Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/12/2022 01:16 PM
Is it possible to put user groups into the To field of email templates? For example am I able to write something like UserGroup(HelpDesk) in the To field of an email template, and it will send the email to everyone in the Help Desk group?
Aundre
Solved! Go to Solution.
04/12/2022 02:47 PM
Hi Aundre,
Could you let us know what/how exactly you are trying to achieve this ?
I assume you are using a workflow where the approval has to happen from a UserGroup that needs to be fetched dynamically ?
or are you simple trying to send an email to a static group, for e.g new onboarded users details to be sent to the same group like HelpDesk Group.
Regards,
Avinash Chhetri
04/12/2022 02:47 PM
Hi Avinash,
We are just trying to send an email from a static group. We have the email template attached to the AD endpoint. When a task completes it will send the email. We want to be able to leverage a user group for the email template TO field instead of manually typing in an email address.
Thanks,
Aundre
04/12/2022 02:47 PM
Hi Aundre,
Dynamically fetching the user group from the workflows to an email template is not available, at least to my knowledge.
However, if you are trying to send an email to a group and you know which group it is, perhaps you can try the below in your email template's TO list :
${com.saviynt.ecm.identitywarehouse.domain.Users.findAllByIdInList(com.saviynt.ecm.identitywarehouse.domain.Usergroup_users.findAllByUser_groupkey(com.saviynt.ecm.identitywarehouse.domain.Usergroups.findByUser_groupname("HelpDesk")?.id)?.userkey).email?.join(‘,’)}
Regards,
Avinash Chhetri
04/12/2022 02:47 PM
Hi Avinash,
I get the attached error when leveraging your code. My current TO field looks like this:
<% if (user?.customproperty4=='Laptop') print "${com.saviynt.ecm.identitywarehouse.domain.Users.findAllByIdInList(com.saviynt.ecm.identitywarehouse.domain.Usergroup_users.findAllByUser_groupkey(com.saviynt.ecm.identitywarehouse.domain.Usergroups.findByUser_groupname("Help Desk")?.id)?.userkey)?.email.join(‘,’)}" else print "${com.saviynt.ecm.identitywarehouse.domain.Users.findAllByIdInList(com.saviynt.ecm.identitywarehouse.domain.Usergroup_users.findAllByUser_groupkey(com.saviynt.ecm.identitywarehouse.domain.Usergroups.findByUser_groupname("Infrastructure Operations")?.id)?.userkey)?.email.join(‘,’)}"%>
Any ideas?
04/12/2022 02:47 PM
Sorry wrong attachment, error attached is what I'm getting.
04/12/2022 02:47 PM - last edited on 12/22/2022 08:06 AM by Dave
Originally posted on November 16 2021 at 23:51 UTC
Hi Aundre,
Based on the screen shot, the error is due to the translation of the apostrophe in the join(',') logic.
Check the attached sample in the notepad.
Regards,
Avinash Chhetri
04/12/2022 02:47 PM
This worked, thanks Avinash.