- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 10:33 AM
Hello,
I am trying to figure out an easy way of finding whether scripts were modified or not. Things like Business Rules, Client Scripts, UI Pages, etc...
Any pointers would be awesome!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:40 PM
You could query all customization records that
-Have NO Version (sys_version) record
OR
-No Versions records created by users that exist in the system
You would have to run it in Production as some version information isn't kept when your clone.
However, I came up a quick script based on that theory.
It assumes that:
- Your user names don't and have never changed
- All records that were created by a user that does not exist in the system is OOB.
- Records modified by a user that can be found in the system is a 'customisation'
Run this as a background script.
var tables = [ //customisation tables here
'sys_script_include',
'sys_ui_action',
'sys_script',
'sys_script_client',
'sysauto_script',
'sys_properties',
'sysevent_script_action',
'sys_ui_policy',
'sys_data_policy2'
];
var length = tables.length;
while (length--) { //Loop through each table
GetModifiedAssetsForTable(tables[length]);
}
function GetModifiedAssetsForTable(table) {
var gr = new GlideRecord(table);
gr.addJoinQuery('sys_user','sys_updated_by','user_name'); //We only want records updated by users in our system
gr.addQuery('sys_updated_by','!=','admin'); //admin account exists and this stuffs up our search
gr.query();
gs.print('***Searching ' + gr.getClassDisplayValue());
while (gr.next()) {
var grUser = new GlideRecord('sys_user');
grUser.addQuery('user_name', gr.sys_created_by );
grUser.query();
if (!grUser.next() ) { //Created by user is not in system (OOB asset)
var msg = gs.getMessage(
"{4} - {0} \r\n\ Created by:\t '{1}'\r\n Modified by:\t {2}\r\n Link: \t {3}",
[gr.getDisplayValue(), gr.sys_created_by, gr.sys_updated_by, gr.getLink(), gr.getClassDisplayValue()]
);
gs.print(msg);
}
}
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 12:41 PM
Hi Justin,
I strongly recommend going through the Upgrades Best Practices, which has a lot of good information on preparing for an upgrade, which happens to also mean preparing for everyday troubleshooting and management of your instance:
https://wiki.servicenow.com/index.php?title=Upgrades_Best_Practices
You'll see that section 6.7 deals specifically with customizations.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:40 PM
You could query all customization records that
-Have NO Version (sys_version) record
OR
-No Versions records created by users that exist in the system
You would have to run it in Production as some version information isn't kept when your clone.
However, I came up a quick script based on that theory.
It assumes that:
- Your user names don't and have never changed
- All records that were created by a user that does not exist in the system is OOB.
- Records modified by a user that can be found in the system is a 'customisation'
Run this as a background script.
var tables = [ //customisation tables here
'sys_script_include',
'sys_ui_action',
'sys_script',
'sys_script_client',
'sysauto_script',
'sys_properties',
'sysevent_script_action',
'sys_ui_policy',
'sys_data_policy2'
];
var length = tables.length;
while (length--) { //Loop through each table
GetModifiedAssetsForTable(tables[length]);
}
function GetModifiedAssetsForTable(table) {
var gr = new GlideRecord(table);
gr.addJoinQuery('sys_user','sys_updated_by','user_name'); //We only want records updated by users in our system
gr.addQuery('sys_updated_by','!=','admin'); //admin account exists and this stuffs up our search
gr.query();
gs.print('***Searching ' + gr.getClassDisplayValue());
while (gr.next()) {
var grUser = new GlideRecord('sys_user');
grUser.addQuery('user_name', gr.sys_created_by );
grUser.query();
if (!grUser.next() ) { //Created by user is not in system (OOB asset)
var msg = gs.getMessage(
"{4} - {0} \r\n\ Created by:\t '{1}'\r\n Modified by:\t {2}\r\n Link: \t {3}",
[gr.getDisplayValue(), gr.sys_created_by, gr.sys_updated_by, gr.getLink(), gr.getClassDisplayValue()]
);
gs.print(msg);
}
}
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:49 PM
This is amazing. Thank you very much for this!