- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 10:18 PM
Help Needed..:)
In the transform map I've marked "Run-script" as true and then writing the script over there.
I'm referencing the location table (cmn_location). My target field name which is a reference field t location table is "u_location". In the location table full name (full_name) is unique.
Question: When i do the data load, the location for which Active (u_active) is FALSE should get ignored ( active is a check-box field).
Following is the script
var gr = new GlideRecord(cmn_location);
gr.addQuery('full_name',source.u_location); // source name in T-Map is "u_location"
gr.addQuery('u_active',false); //query location table if the record is false
gr.query();
while (gr.next())
{error_message='';
ignore=true; // here it should ignore the record which is Active = false, but this script is not working
}
any help is appreciated.
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 11:46 PM
Thank for the help Arpit,
i figured out the problem which was that both of us forgot to put single quotes in the glide record. It should be like
var gr = new GlideRecord('cmn_location'); //single quotes and the function is runnig
gr.addQuery('full_name',source.u_location);
gr.addQuery('u_active',false);
gr.query();
while (gr.next())
{error_message='';
ignore=true;
}
appreciate you help buddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 10:31 PM
Try this:
var gr = new GlideRecord(cmn_location);
gr.addQuery('full_name',source.u_location); // source name in T-Map is "u_location"
gr.addQuery('u_active',false); //query location table if the record is false
gr.query();
while (gr.next())
{
error = true;
error_message='';
//ignore=true; // here it should ignore the record which is Active = false, but this script is not working
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 11:46 PM
Thank for the help Arpit,
i figured out the problem which was that both of us forgot to put single quotes in the glide record. It should be like
var gr = new GlideRecord('cmn_location'); //single quotes and the function is runnig
gr.addQuery('full_name',source.u_location);
gr.addQuery('u_active',false);
gr.query();
while (gr.next())
{error_message='';
ignore=true;
}
appreciate you help buddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 11:42 PM
Try the below code in script part.
if(target.u_active == false);
ignore = true;