Script for task assignment based on selected zone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 06:48 AM
New to scripting
Please excuse my lack of knowledge as I'm still learning.
I have a drop-down field on the catalog form called > Device Location Zone (See pic 1).
I would like to build a script for the following :
1. When user selects Calgary in the list > Assign the sctask to Deskside Support - Calgary zone (Sys id = 5df87de993c28210ef61fbf08bba108d)
2. When user selects Edmonton in the list > Assign the sctask to Deskside Support - Edmonton zone (Sys id = b8ab37f6c399ae10886c5fd1b40131fe)
I tried but not sure if i'm doing the right steps. Can someone help me?
I tried writing a script in flow designer (See pic 2 and 3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 06:41 AM
that's a different issue I believe.
Your question is related to populating assignment group based on variable value.
Did that work for you?
var zone = fd_data._1__get_catalog_variables.device_location_zone.toString();
// give the correct choice value to compare
if(zone == 'choiceValue')
return 'groupSysId1';
else
return 'groupSysId2';
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
05-28-2025 06:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 06:52 AM
nterestingly, when i did a test in flow designer it is showing as successfully completed.
When I submit a request, no task is being triggered.
Any thoughts?
Looks like we're getting closer. Previously the test was failing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 05:39 AM
Did you configured this flow under catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 10:06 AM
you can use inline script and set it like this
var zone = fd_data._1__get_catalog_variables.device_location_zone.toString();
// give the correct choice value to compare
if(zone == 'choiceValue')
return 'groupSysId1';
else
return 'groupSysId2';
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