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-27-2025 07:14 AM - edited 05-27-2025 07:15 AM
if 'device_location_zone' is a reference field, then you need to use the sys_id for 'Calgary' and 'Edmonton' in the script. Or is that field defined with Choices? If so, use the value for those two choices.
I'm not familiar with Flows, the alternative approach is to use a Client Script and corresponding Script Include to do what you want. There are OOB examples in your instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 08:28 AM
device_location_zone is not a reference field. Its a field with 2 choices > Calgary and Edmonton.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 07:19 AM - edited 05-27-2025 07:21 AM
Hello, try this
var calgaryGroup = '5df87de993c28210ef61fbf08bba108d';
var edmontonGroup = 'b8ab37f6c399ae10886c5fd1b40131fe';
// Assign group based on selected location
if (fd_data.trigger.request_item.variables.device_location_zone.getDisplayValue() == 'Calgary') {
return calgaryGroup;
} else if (fd_data.trigger.request_item.variables.device_location_zone.getDisplayValue() == 'Edmonton') {
return edmontonGroup;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 08:29 AM
Hi Muhammad,
I tried it ....didn't work