Need to populate group members in worknotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 10:38 PM
Hi Team,
Based on the assignment group selection on the incident in need to populate all the group members in worknotes.please help me with the approach and script.Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 11:40 PM
Hi @Feroz1,
You can write a Before Business Rule on insert/update. Below is an example script:
(function executeRule(current, previous /*null when async*/) {
var memberArr = [];
var grpMemberGr = new GlideRecord('sys_user_grmember');
grpMemberGr.addEncodedQuery('group=' + current.getValue('assignment_group'));
grpMemberGr.query();
while(grpMemberGr.next)
{
memberArr.push(grpMemberGr.user.name.toString());
}
if(memberArr.length != 0)
{
current.work_notes = "Members of the group are " + memberArr.join(',');
}
})(current, previous);
Hope it helps, thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 08:30 AM
Hi James I have written the br. But the script is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 08:34 AM - edited 02-22-2024 08:35 AM
Hi !
The script shared above must work ! But you have to make sure you have configure your BR properly. Check the when to run condition and try to add logs in script to see we're it's stopping .
When do you want this worknotes to be updated ? What's your condition...
Share screenshot of possible...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....