The CreatorCon Call for Content is officially open! Get started here.

Script for task assignment based on selected zone

Neelu3
Tera Contributor

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)

20 REPLIES 20

Hi Ankur,

I tried your inline script but didnt work.I'm not sure if i'm doing something wrong.
I have attached a screenshot of the script you sent (Name is Inline script)

@Neelu3 

are you giving the correct choice values for that drop down to compare in script?

print the value and see

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Muhammad Salar
Giga Sage

Issue is because of label, use backend value of choice and it will run perfectly for any method either inline script or directly in assignment group script, i have tested this with choice backend value and group is populated see screenshots

MuhammadSalar_0-1748457138407.png

MuhammadSalar_1-1748457187316.png

 

 

I've done exactly what you've shown in your screenshot but the task is still not triggering.

This maybe an isolated issue.

When I run a test in flow designer everything seems to be showing as 'Completed'.

 

I used .toString(), didn't use getDisplayValue() in if condition and please check if your choice backend value is same as you have used in script.

Did you see anything for task step in flow executions? what is the output?