Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

Using user groups in email templates

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 4 2021 at 19:55 UTC

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

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
7 REPLIES 7

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 5 2021 at 16:33 UTC

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

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 5 2021 at 17:09 UTC

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

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 5 2021 at 17:28 UTC

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


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 16 2021 at 20:48 UTC

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?

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 16 2021 at 20:48 UTC

Sorry wrong attachment, error attached is what I'm getting.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee

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

 

 

 

 

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 17 2021 at 14:05 UTC

This worked, thanks Avinash.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.