- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 08:51 AM
How do I set the value of the "source" field in the "syslog" table from a server-side script?
The solution on How to use gs.log states that gs.info accepts "source" as its secondary parameter; however, I have tried this, and the "Source" field on the resulting message in the syslog table remains "*** Script". Furthermore, the official developer docs note that the parameters of gs.info act as variable substitution values for the first parameter:
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 10:06 AM
You cannot set the Source in gs.info.
Why not use gs.log instead?
gs.log("dummyMessage","dummySource");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 08:54 AM
you can try using gs.info('message','source'). This will add a log record in the sys_log table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 09:01 AM
There is no "sys_log" table. name=sys_log returns null from the System Definition > Tables page. There is a "syslog" table, but the syntax you just described does not work. I explained that this syntax does not work in my original post, in fact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 10:06 AM
You cannot set the Source in gs.info.
Why not use gs.log instead?
gs.log("dummyMessage","dummySource");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2019 03:21 PM
That works!
var logSource = "Notify case owner 2.0";
var instanceId = current.instance;
var emailType = current.type;
var targetTable = current.target_table;
var msg = logSource + ' current.type: ' + emailType + '\n' +
'target_table: ' + targetTable + '\n' +
'current.instance: ' + instanceId;
My problem was that I've been using the API Reference at developer.service-now.com, and this includes zero documentation for gs.log, so far as I can see. I see now that the JavaScript API reference on docs.service-now.com documents the function in question: https://docs.servicenow.com/bundle/madrid-application-development/page/app-store/dev_portal/API_refe....