Choice list options depending on value of another field

PiotrekL
Tera Expert

Hi

 

I need to have choose list option available depending on choice on another field. Exactly when I have BAU option chosen I need to have other option displayed on the list. Below client script works perfectly but then form is saved. I need to have it working before it is saved. so empty form. I choose BAU and Other is available. Do I need to use GlideAjax or can it be done in the other way? I checked onChange client script but also without success. 

 

 

function onLoad() {


var bau = g_form.getDisplayBox('u_portfolio_parent').value;
if (bau != 'BAU'){
g_form.removeOption('u_delivery_type','other', 'Other');
}
}

 

 

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You need to change this to an onchange client script that runs onload as well and it runs on change of u_portfolio_parent field.

-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You need to change this to an onchange client script that runs onload as well and it runs on change of u_portfolio_parent field.

-Anurag

AnubhavRitolia
Mega Sage
Mega Sage

Hi @PiotrekL 

 

You can make Dependency on 'Delivery Type' field as below:

 

AnubhavRitolia_0-1667833411055.png

 

On Dependent on field you can select Portfolio Parent.Value.

 

Also you have to set Dependency values on your Choices of Delivery Type field as below:

 

AnubhavRitolia_1-1667833533579.png

 

 

 

 

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

admin0923093239
Tera Contributor

Can I do this in a

Select Box?