Transform Map Condition - Update target table

Desmo
Mega Guru

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.

5 REPLIES 5

This does not work because the field map record's script function does not have access to the target record, only the source.