set assignment group in RITM using script in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2025 07:55 AM
i have created a list collector variable in a catalog item. the list collector contains locations data. i want that when user orders the catalog item, an assignment group is assigned to the RITM based on the count of locations ordered by the user. i want to write script in the workflow to execute this logic.
i wrote this script but it is not setting assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2025 02:40 PM
One thing that jumps out to me right off the bat is this line:
approval.approver_group = 'HR agent';
This should be a sys_id and not the words 'HR agent'
I would recommend pasting your entire script into Background Scripts and going line-by-line to figure out where it is failing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2025 08:47 PM
if this is written in workflow run script then script is fine.
are you sure the group name used in Query is correct i.e. HR agent and HR head
Also update line as this -> split should be with comma , and not semicolon
var locations = current.variables.select_location.split(",");
gs.info('Locations Array: ' + locations);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader