how to check if field values changed before save
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2015 09:30 AM
Hey there,
I am trying to update my table specific Update & Save UI actions to check if any values have changed before UI action executes. I am sure there is an action out there, but is there one that will work with UI Actions.
If I copy a record, is there way to check if any values have changed since the original copy? Here is what I have:
var ts = new GlideRecord('u_time_sheet');
ts.addQuery('u_week_starts_on', current.week_starts_on);
ts.query();
if (ts.u_week_starts_on != '') {
gs.clearMessages();
gs.addErrorMessage('A timesheet already exists for that time period. Please verify and try again. ');}
else {
action.setRedirectURL(current);
current.update(); }
if (! current.isActionAborted())
action.setRedirectURL(current);
I know that this will execute and give the error not matter what, cause the record will always be there, hence.... I have to test to see if any value changed.
Any help would most appreciated.
Thanks in advance!
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2015 09:41 AM
Hi Wade,
The below article should answer your question.
http://www.servicenowguru.com/scripting/business-rules-scripting/checking-modified-fields-script/
I hope this helps