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 have an on change client script apply to a field from an extended table

AM24
Giga Guru

Hello,

 

I have two fields from an extended table, "Reason" and "Text Box", that I display on the parent table. "Text Box" should be hidden. If a certain choice, "other" is selected on the "Reason" field, "Text Box" should no longer be hidden. I am able to do this on load with a UI policy, where I just do:

 

if(g_form.getValue('u_dextension.reason') == 'other'){

g_form.setVisible('u_dextension.text_box', true);

} else{

g_form.setVisible('u_dextension.text_box', false);

}

 

This works, but it requires me to update the entire form. I was wondering if there was a way to do this upon just change of the field, similar to an on change client script. So when I simply click another choice, the "text box" field could be shown or hidden instantly. Thanks.

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@AM24 

I don't think so since you might not be allowed to select that field on parent table's onChange client script

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader