We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

how to fetch selected dropdown value of the variable in catalog task

Sachin G K1
Kilo Sage

Hi Team,

 

I have dropdown field called device which has 2 options mobile and laptop. User can select any one of these option while submitting the request.

 

I wish to fetch the value the user has selected in "reusable flow step" script. so i can include it in catalog task short description. i,e if user has selected mobile. the short description of task should be "user has selected mobile".

 

I wish to achieve this without using data pill and only through script.

 

 

 

Thanks in Advance

3 REPLIES 3

Brandon65
Tera Contributor

I hope this helps.

 

Enable advance script and call the variable.

 

task.short_description =  "User has selected " + current.variables.DEVICEVARIABLENAME.getDisplayValue();

 

Change DEVICEVARIABLENAME to the name of your form's variable.

this is not working.

Are you using Workflow for this Requested Item?

I've created a quick Item that has a select box using Mobile and Laptop as the 2 options.

In the workflow I use a 'Catalog_Task' and checked advance applied the following code to set the Short Description.

task.short_description = "User has selected " + current.variables.device_cust.getDisplayValue();

 

device_catalogtask.PNGSC_Task.PNG