How to tag a user in work votes via business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
How do you tag a specific user via a business rule when you update the work notes field? Simply hard coding @full_name wouldn't work if there are multiple users with the same name. You can't @ their email address or user ID either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
hey @e_wilber
In ServiceNow, @mentions don’t work using names, emails, or sys_ids directly. That’s why hard-coding @Full Name fails when multiple users share the same name, and using email or user ID doesn’t trigger a mention.
Tag the Assigned to user when updating work notes.
Business rule :
(function executeRule(current, previous) {
if (!current.assigned_to.nil()) {
var userSysId = current.assigned_to.toString();
current.work_notes =
"Please review this update " +
"@[sys_user:" + userSysId + "]";
}
})();
*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @e_wilber ,
here is how to do it
you can replace the gs.getUserID() with target user's sysid and gs.getUserDisplayName() with displayName of the target user and
'@['+gs.getUserID()+':'+gs.getUserDisplayName()+']'
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
