- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 08:33 AM
Hello, I need a way to know through a business rule if a field was modified, this will be checked every time I save the form or send it
I tried to use the functions of this web page, but it seems that they no longer work at the moment
https://servicenowguru.com/scripting/business-rules-scripting/checking-modified-fields-script/
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 02:27 AM
you can try something like this?
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sys_dictionary');
gr.addQuery('name=incident^ORname=task^element!=NULL'); // Replace 'incident' by the table that is relevant to you
gr.query();
while (gr.next()) {
if (current[gr.element] != previous[gr.element] ) {
gs.addInfoMessage ('Field ' + gr['name'] + '.' + gr.element + ' has changed!' ); // Insert your here code to save log where you want
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 08:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 09:10 AM
I'm looking for all fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 02:27 AM
you can try something like this?
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sys_dictionary');
gr.addQuery('name=incident^ORname=task^element!=NULL'); // Replace 'incident' by the table that is relevant to you
gr.query();
while (gr.next()) {
if (current[gr.element] != previous[gr.element] ) {
gs.addInfoMessage ('Field ' + gr['name'] + '.' + gr.element + ' has changed!' ); // Insert your here code to save log where you want
}
}
})(current, previous);