Get only script value using gs.print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 12:22 PM
Dear All,
Please help how can get only script value result in background script.
When i run the background script i all get time and other information with the script result
Also is there any possibility only to export the script result to csv.
Thanks in advance,
Kavya
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 01:09 PM
Hi Kavya,
Use gs.log() in place of gs.print() to have output write to the log table. The following example will query the sys_user table for 10 records, iterate and write them to the log table.
var logSource = "User Script";
var sysUserGR = new GlideRecord('sys_user');
sysUserGR.setLimit(10);
sysUserGR.query();
while(sysUserGR.next()) {
gs.log("User : " + sysUserGR.name, logSource);
}
You can then filter the log table source column for 'User Script' and export the results in the appropriate format. I hope that's what your after.
- Leo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 02:01 PM
Below post has solution to your question
Script Background - GS.PRINT - value from databse
Regards,
Sachin