The Zurich release has arrived! Interested in new features and functionalities? Click here for more

set values based on drop down selection ( onChange client script)

sonita
Giga Guru

There is a drop down on the catalog form woth two values ( A , B)

if A is selected , some of the fields on the form should be populated . We have some list collectors on the form ,that need to be populated with more than one value ; how can I achieve this.

And even if one value neeeds to be added , this code doesn't work: ( the type of salesforce_role is a list collector)

 

 g_form.setValue('salesforce_role', 'Client Services');

 

and there are some checkboxes on the form that need to be checked if A id selected.

 

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron
You can use setValue on both checkboxes and list collectors. For list collectors you will have to set value to comma separated sysids of the items you want to populate

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

SanjivMeher
Kilo Patron
Kilo Patron
You can use setValue on both checkboxes and list collectors. For list collectors you will have to set value to comma separated sysids of the items you want to populate

Please mark this response as correct or helpful if it assisted you with your question.

actually it didn't work; how about checkbox ;

 

g_form.setDisplay('access_hindsight',true);

 

this is not working

For Checkbox use

 

g_form.setValue('access_hindsight','true');

 

For List collector, which version of servicenow are you on? There seems to be a known error. You can convert it to glide_list and try, if that works.

 

https://hi.service-now.com/kb_view.do?sysparm_article=KB0622779


Please mark this response as correct or helpful if it assisted you with your question.

    

This is part of the code for the list collector

 

if(newValue=='CS Coordinators')
{

g_form.setValue('salesforce_role','d8295e9ddbcd638039803c00ad96197a');

 

it doesn't show anything

 

find_real_file.png