Same choices dependent on multiple values

Khanna Ji
Tera Guru

I have a state field with values as Pending and Review and few other values.

I have a substate field which is dependent on state field. When state is Pending/Review, sub state should show below values;

  • Pending Change
  • Pending Incident
  • Pending Problem

How can I have same values dependent on Pending as well as Review?

 

 

6 REPLIES 6

Shambhu5
Kilo Guru

Hi Swathi,

You can write onLoad Client Script for this dependancy. 

Please find below sample code for the same:

function onLoad() {
	//Type appropriate comment here, and begin script below
	if(g_form.getValue('state') == '1'){
		g_form.removeOption('state', '2'); // your substate values which you want to hide
		g_form.removeOption('state', '3');
		g_form.removeOption('state', '6');
//		g_form.removeOption('state', '7');
//		g_form.removeOption('state', '8');
	}
}

You can also make use of g_form.addOption() method, which will add your substate choices (already present) on selection of a particular state.

Hope this helps!

Please mark my answer as Correct/Helpful in case that helped.

Regards,
Vishrut
find_real_file.png

Thank you.

Script working fine on form but users becoming smart. They found a bug and setting the value from the list view.

 

How to make sure the removed options are also not present in the field from list view?

Shashikant Yada
Tera Guru

You can configure without using any script, add the dependent field under substate and dependent value under choices.

 

find_real_file.png

Thanks
Shashikant

Hit Helpful or Correct on the impact of response.