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.

Make Dropdown value according to another field

avinashdubey103
Tera Guru

Hi , i have requirement to make the dropdown value dependent on a catalog item

 

When the user selects the option ‘Change Cellular Solution’ under ‘Service Type’ and progress to the next field i.e., ‘Solution Type’, then it should display the below 4 options in its dropdown menu.

  1. Private Line Reimbursement.
  2. Bring Your Own Device (BYOD).
  3. Change carrier.
  4. Change ownership (Porting/Mobility).

But for 'New cellular solution' it should display the existing 2 choices only in its dropdown.

i.e.,

  1. Private Line Reimbursement.
  2. Bring Your Own Device (BYOD).

 

I tried creating a UI Policy and action but not able to figure out the logic

1 ACCEPTED SOLUTION

mdash
Giga Guru

You can write an OnChange client script on "Service type" field.

Like this:

var serviceType= g_form.getValue('<backend value of Service Type>');

if(serviceType=='<backend Value of Change Cellular Solution>'){
g_form.clearOptions('<backend value of Solution Type>');
g_form.addOption('<backend value of Solution Type>', 'Label 1', 'Value 1', 100);
g_form.addOption('<backend value of Solution Type>', 'Label 2', 'Value 2', 200);
//and so on
}
else if(serviceType=='<backend Value of Change Cellular Solution>'){
g_form.clearOptions('<backend value of Solution Type>');
g_form.addOption('<backend value of Solution Type>', 'Label X', 'Value X', 100);
g_form.addOption('<backend value of Solution Type>', 'Label Y', 'Value Y', 200);
//and so on
}


 You can mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Best Regards

View solution in original post

1 REPLY 1

mdash
Giga Guru

You can write an OnChange client script on "Service type" field.

Like this:

var serviceType= g_form.getValue('<backend value of Service Type>');

if(serviceType=='<backend Value of Change Cellular Solution>'){
g_form.clearOptions('<backend value of Solution Type>');
g_form.addOption('<backend value of Solution Type>', 'Label 1', 'Value 1', 100);
g_form.addOption('<backend value of Solution Type>', 'Label 2', 'Value 2', 200);
//and so on
}
else if(serviceType=='<backend Value of Change Cellular Solution>'){
g_form.clearOptions('<backend value of Solution Type>');
g_form.addOption('<backend value of Solution Type>', 'Label X', 'Value X', 100);
g_form.addOption('<backend value of Solution Type>', 'Label Y', 'Value Y', 200);
//and so on
}


 You can mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Best Regards