onChange client script not changing field value on same form on different sections
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2023 10:40 AM
i have a field Amount on two sections on the same form, i have written an onChange client script to clear the 'Amount' field on change of Product field. I can see the change on one section clearing the field while on the other section the change is not happening, can someone point to me on how can i fix this?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (oldValue!= newValue){
g_form.clearValue('u_amount');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2023 11:11 PM
Hello @Nishant16
It seems you are running into a known error PRB094076/KB0749081
It is not recommened to have the same field on multiple sections on the form, and the fields might not be updated simultaneously,
The suggested workaround provided by ServiceNow is -
Remove one of the fields from the form so that it appears one time only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2023 11:25 PM
Hello @Nishant16
can you please check have you make Global Field Check Box to True?
Mark my Response as Correct or Helpful, if you find it Appropriate.
Gaurav Shirsat : ServiceNow Community MVP 2022
https://www.linkedin.com/in/gauravshirsat/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2023 05:07 AM
But ServiceNow always suggests not to use the same field on a form or form section more than once.