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.

Record producer hide option in variable depending on other variable

CE_
Tera Contributor

Hi,

I have a record producer where the options in select box variable "Report" needs to be adjusted based on the value in variable "Category". So if category is A then option 1, 2, 3, 4 should be visible in "Report". But if category is B then only option 1 and 2 should be visible. How to script this? 

 

Thanks!

1 ACCEPTED SOLUTION

onCHange client script

field name : category

 

if(newValue =="Backend name of Description"){

g_form.removeOption("backend name of Report variable",'backend name of the option you want to remove');

g_form.removeOption("backend name of Report variable",'backend name of the option you want to remove');

 

//like this you can keep on adding line into this loop

}

 

Code explaination:

if category is general all the option will be shown if it is description then i am reoving some option

 

Please mark it as correct and helpful if this answer satisfies your query

View solution in original post

5 REPLIES 5

onCHange client script

field name : category

 

if(newValue =="Backend name of Description"){

g_form.removeOption("backend name of Report variable",'backend name of the option you want to remove');

g_form.removeOption("backend name of Report variable",'backend name of the option you want to remove');

 

//like this you can keep on adding line into this loop

}

 

Code explaination:

if category is general all the option will be shown if it is description then i am reoving some option

 

Please mark it as correct and helpful if this answer satisfies your query