Conditionally skipping records in a Transform Map script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2009 04:04 PM
I am importing records from an Excel spread sheet. I need to be able to conditionally skip records. In my transform map script, I do something very similar to the following:
var incident = new GlideRecord("incident");
incident.addQuery("", source.field_name);
incident.query();
if (incident.next()) {
< populate target record here >
}
else {
skip input record
}
What I need to know is how to skip the record. I tried specifying ignore=true in the 'else' block, but then every input record was skipped. And if I don't specify ignore = true, then a large number of basically empty records were inserted into the database.
Anyone have any idea what to do here?
Thanks,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2011 01:11 PM
hmm..I am not sure if this could be achieved without defining Field Map. I have implemented exact thing on my side with field Map with Coalesce on on the User ID and choice action to ignore on reference field.
also, I have used onbefore script if this helps..
var userid = new GlideRecord('sys_user');
userid.addQuery('user_name', source.u_name);
userid.query();
if(userid.next()){
//processing to update
} else
ignore=true;