- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 05:10 AM
Hi All,
I am trying to create an inbound web service which has a 'onBefore' transform script. I want to use it to filter input for my target table. But from whatever little I know, it seems the script is not executing. Enabling all debugging, I see some errors.
I see a lot of these -
05:03:20.747: Attempted script access to inaccessible member denied - com.glide.script.ElementDebugMessage:getType:()Ljava/lang/String
& some of these -
05:03:20.756: App:Dashboards TIME = 0:00:00.000 PATH = ui_action/a315c1539f0120007aaa207c7f4bccff/execute CONTEXT = onBefore RC = false Rule =
|
I have no idea what they mean. My script is as follows:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var user = source.u_user_name;
var id = source.u_id;
gs.log('Adding row for agent id ' + id, 'TransformMap');
var querystring = 'user=' + user + '^ORusernamealias=' + user;
var mem = new GlideRecord('x_91069_das_members');
mem.addEncodedQuery(querystring);
mem.setLimit(1);
mem.query();
if (mem.next()) {
if (mem.type != 'AGENT') {
ignore = true;
gs.log('Import row for non-agent id ' + id + 'ignored.', 'TransformMap');
}
else {
gs.log('Import row for agent id ' + id + 'added.', 'TransformMap');
}
}
else {
gs.log('Import row for unknown id ' + id + 'added.', 'TransformMap');
}
})(source, map, log, target);
Any idea what am I doing wrong here?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 11:21 PM
You need to go to System Import Sets -> Transform History and select your related import set. It would contain the logs added by log.function();
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 11:41 PM
Thank you! That works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 11:45 PM
Glad it worked, If I was able to answer your query, can you please mark my response as correct answer so we close this thread.
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 10:40 PM
Refer the below link for more info :
http://wiki.servicenow.com/index.php?title=Transform_Map_Scripts#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 10:55 PM
HI Anshuman,
From you query , please try to create the after transform script as you want to validate and Filter out for your target table. SO i would suggest try to make it after transform script and lets give it a try.
and also from the debug output it seems that there is some role based restriction.
so please In a transform map script, you need to use log.info() , log.warn() and log.error()