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 set multiple choice variable value in catalog client script

sunil7
Giga Expert

Hey everyone very good morning

I want to set the multiple choice variable value to true at the onchange catalog client script. I have written script but it's not working please help

find_real_file.png

find_real_file.png

 

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi,

please try below onchange client script.

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    g_form.clearValue('request_type');
    g_form.setValue ('request_type', 'test2');  //you need to pass variable name and choice value
       
}

 

Hope you it helps you.

Please Mark Correct/helpful if applicable, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

1 REPLY 1

Pavankumar_1
Mega Patron

Hi,

please try below onchange client script.

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    g_form.clearValue('request_type');
    g_form.setValue ('request_type', 'test2');  //you need to pass variable name and choice value
       
}

 

Hope you it helps you.

Please Mark Correct/helpful if applicable, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar