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

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

PavanK960672992
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

PavanK960672992
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