
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:06 AM
I have created an inbound email action which is in scoped application.
here the problem is If I glide record user table to check and set the user as "guest". it doesnot create the record. it jus skips the inbound email action.
Here is the code.
current.short_description = email.subject; // Set email subject
current.description = email.body_text; // set email body
var eto = email.to.toLowerCase().toString();
var sid='';
var rec = new GlideRecord('sys_user');
rec.addQuery('email',email.from);
rec.query();
if(rec.next()){
gs.log("inside");
sid = rec.sys_id.toString();
gs.log("user is"+sid);
}
if(sid=='')
{
gs.log("else");
sid = gs.getUser().getUserByID('guest').getID();
gs.log("user is"+sid);
}
current.u_caller = sid;
current.insert();
NOTE: If i use same code for global application. it does work . I am not sure why it is not working for scoped application.
Can any one sort this out?
Harish
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:29 AM
As noted earlier, gs.log() is not available in scoped applications. Please use the scoped debugging methods in scoped scripts.
Scoped Script Logging - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:29 AM
As noted earlier, gs.log() is not available in scoped applications. Please use the scoped debugging methods in scoped scripts.
Scoped Script Logging - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 06:46 AM
Thanks Chuck. gs.log was the issue.
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 06:50 AM
You are welcome. I'm glad you got it resolved. It took me a while to convert, but now i use the new methods in global or scoped apps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 06:58 AM
Is there any blog I can find about your new method chuck?
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 07:00 AM
The new methods (gs.debug/info/warn/error) are documented in the link provided earlier, complete with a video.