How to assign assignment group as per location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 03:27 AM
I am working on catlog item, my requirement is when line manager approve a request then it should be assign to that particular team as per the location.
In UI there is location field if requestor will select any location .
so according to that location it should be assign to that particular location team.
For this i have to create workflow. I m trying it with Run script
please provide solution on it.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 03:59 AM
your script is wrong.
please share your script here
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 05:04 AM
I believe you have created custom location field on sys_user_group table
Based on that you want to set the catalog task group?
If yes then this advanced script will help in Catalog Task activity in workflow
var loc = current.variables.current_location; // give correct variable name here
var groupRec = new GlideRecord('sys_user_group');
groupRec.addQuery('u_location', loc); // give here the custom location field name
groupRec.query();
if (groupRec.next()) {
task.assignment_group = groupRec.getUniqueValue();
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 08:20 PM
Hope you are doing good.
Did my reply answer your question?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 04:06 AM
Hello @RunaliP ,
Why you have created workflow? Instead of creating a workflow, consider using a Flow in Flow Designer. You can utilize If-Else conditions to evaluate the location selected in the catalog. Based on the selected location, use the Update Record action to assign the appropriate Assignment Group dynamically.
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish