Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to populate drop down values dependent on reference field value in service catalogs

sony8
Tera Contributor

I have below requirement for my service catalog variable.

Variable1 - reference from xyz table

Variable2 -dropdown

if Variable1 is abc {

show the below values from Variable2 dropdown

Choice value1

choice value2

}

Else{
show the below values from Variable2 dropdown

Choice value1

Choice value3

}

 

I want to show the values based on reference value selected and drop down changes accordingly.

 

I am new to build service catalog. Anyone have any idea regarding this please help me.

 

thanks in advance 

4 REPLIES 4

Omkar Kadoli
Tera Contributor

Hi @sony8 ,

I think you need to write "onChange" client Script for that dropdown particular catalog item variable ex.= "Variable2 -dropdown".

1.PNG

 

You can add your reference field name & dropdown list name and try it.

 

If I have answered your question, please mark my response as correct and/or helpful.

 

Thanks, 

Omkar

 

@Omkar Kadoli  we will not use glideRecord on client script. So below will not work.

 

 

@sony8  Yes we cannot use GlideRecord on client script because its not best practice.

But  I try using Catalog client script And its working so you just try it your end if its not working then let me know.

Hi Omkar,

 

I tried this on my end for the same scenario and whenever I test this on service portal, it says error in JS code. Any insights on this? Thanks!