- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 09:53 AM
I've added the Simultaneous Alert functionality written by ServiceNow Guru (Handling Simultaneous Updates in ServiceNow - ServiceNow Guru ) to my dev instance. With only minor changes, it works exactly as expected.
The request that has me stumped pertains to tracking how often this alert functionality is called.
I can't add a counter field to the record as that would trigger another update and likely cause a loop.
So adding a log statement that we can at least report on (in some fashion) sounds like the way to go. However, I can't find anything on writing to the system log from a client script. The "jslog" command writes to the JavaScript log, but that's only available while you're debugging. I need something I can check on a weekly basis to see how many records were simultaneously edited.
I'm pondering adding a new table simply for the purposes of tracking this data. My gut feeling though is that this will only be monitored for a short while and that a new table is probably tackling the issue with a sledgehammer.
Any suggestions are very much appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 01:41 PM
If you use the code provided by Mark (crossfuze / servicenowguru) there is no need for additional ajax calls.
The onsubmit function already has an AjaxCall to verify the timestamps:
var ga = new GlideAjax('SimultaneousUpdateAlert');
ga.addParam('sysparm_name', 'checkUpdate');
ga.addParam('sysparm_tableName', tableName);
ga.addParam('sysparm_sysID', sysID);
ga.addParam('sysparm_user', g_user.userName);
ga.addParam('sysparm_silent_request', 'true'); // don't log on the server
ga.getXMLWait();
as is seems you only need to change sysparm_silent_request to false to make a log entry.
If not, check the Script Includes to find the one mentioned here and add your logging in there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2016 07:06 AM
Thanks for this. It worked perfectly.
I changed the parameter in the Listener and Submit client scripts:
ga.addParam('sysparm_silent_request', 'false'); // log on the server |
And updated the script include:
caseNumber = rec.number.getDisplayValue()
gs.log("Simulatenous Alert called - " + caseNumber, "SIMU ALERT");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2016 07:06 AM
I really like this solution - it looks like it should be re-usable if you need logging from client scripts.
Thanks for the help!