How use a client script to check which fields were modified?

EJ13
Tera Contributor

I am writing an onSubmit client script on the Incident table. The goal that it will perform a certain action if the form was modified, except in the case that only "assigned to" and/or "assignment group" are modified. I am currently using g_form.modified to check if anything was modified at all, but I am not sure how to verify that only those two fields are changing. Is there a way to determine which fields are changing without checking each one individually?

 

Thank you!

2 REPLIES 2

Adrian Ubeda
Mega Sage

Hello @EJ13

 

I have done something similar, but I had to use g_scratchpad in the onSubmit client script. I had control all changes in a onChange script separately and then unified values in the onSubmit client script

Here's some link which was useful for me: https://www.servicenow.com/community/developer-forum/g-scratchpad/m-p/2225478

If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆

yashkamde
Tera Expert

Hello @EJ13 ,

There is one OOTB Table 'sys_audit' which track changes to each single change in any servicenow table,

So when I change the assignment group from Network -> Hardware & assigned to from empty -> Bow ruggeri
Screenshot 2026-01-15 223433.png


It's got captured in this table as record in form of new value and old value
Screenshot 2026-01-15 223419.png

 

So in this way you can keep the track of the changes you had made..

If my response help, mark as helpful and accept the solution..