Reload a form when field value changes from No to Yes.

Lina5
Tera Contributor

Hi,

We have a requirement where we need to make rest other fields disabled when in particular field(Yes/No field) value is selected as "No". Written a onChange client script for this which is working.

Here we need to Reload the form when user changes the value from "No" to "Yes". Can I know which script should be added for this.

note: when "Yes" is selected initially form should work normally.(no need to disable fields /reload form)

 

Thanks in advance!

 

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

why to reload when value changes? what about the fields which user entered? they won't be saved automatically and user will get pop-up message.

regards
Ankur

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

Aman Kumar S
Kilo Patron

Hi @Lina

You can try below code command in your onChange client script

location.reload()

 

Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar

Will this script work?

if (( oldValue == No   && newValue == Yes )

reloadWindow(the page with we want to reload);

location.reload();

 

 

Lina5
Tera Contributor

No need to save the fields which user already entered. 

It's the requirement, that when user will select No first and then changes to Yes, then whole form should be refreshed.