- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
I am currently creating email notifications like the following:
Who will receive: Users/Groups in fields “assignment group”
What it will contain: Message HTML (message body)
I want to display the names (name) of users belonging to the group in the message body. How can I do this?
解決済! 解決策の投稿を見る。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
I resolved this by sending the sysid of user and group as parameters during the event and using those values to create an email notification script.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日 - 最終編集 昨日
To display the names of users belonging to a specific group within a ServiceNow email notification body, you must use a Mail Script to query the group member table (sys_user_grmember) and print the names dynamically
- Navigate to System Notification > Email > Notification Email Scripts.
- Click New.
- Name: get_group_members
- Script:
(function runMailScript(current, template, email, email_action, event) { // Assume 'assignment_group' is the field on the current record (e.g., Incident) if (groupId) { var gr = new GlideRecord('sys_user_grmember'); gr.addQuery('group', CURRENT.YOUR_GROUP_SYS_ID); gr.addQuery('user.active', true); // Only active users
gr.query(); template.print("Group Members:\n"); while (gr.next()) { // Get the user's name template.print("- " + gr.user.getDisplayValue() + "\n"); } } })(current, template, email, email_action, event); - Click Submit.
- Open your Email Notification.
- In the Message HTML body, add the following line where you want the names to appear:
${mail_script:get_group_members} - Save the notification
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
Thank you for your comment.
However, what I want to do is not display all the names of members belonging to a group in a single email, but rather display the name of the recipient user in the body of the email sent to each individual user. The idea is something like “Dear ${user.name}”.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日 - 最終編集 昨日
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
not possible to include member's name when email goes to group
use after insert/update BR and fire event per group member, then it's possible
Populate Assignment Group members first name in Email body of notifications -> approach from Kieran
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
