Transform Map Condition - Update target table

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2021 10:13 AM
Hello,
I have transform map with an onbefore script to query the target table. The intent is to only update specific records based on a field value. I'm using a coalesce field. Note: There can be more than one record that has the same value in the coalesced field, which is the reason I like to use a query. Also, a record should not be inserted if no match is found.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord('ast_service');
gr.addQuery('type', 'Contract'); //look for this record type
gr.query();
if(!gr.next()){
update = true;
}
else{
if (action == 'insert' ){
ignore = true;
}
}
})(source, map, log, target);
Thanks.
Labels:
- Labels:
-
Scripting and Coding
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2025 10:06 AM
This does not work because the field map record's script function does not have access to the target record, only the source.