How to update a target field without coalesce in transform map

Dharma5
Tera Contributor

Hi 

 

I want to update an active field in target table if business area is XYZ, I tried the code below but it is inserting a new record instead of updating existing record

 

var resGrp1 = new GlideRecord('restricted_groups');
resGrp1.addQuery('group_id', source.u_group_number);
resGrp1.addQuery('business_area', XYZ);
resGrp1.addQuery('active', false);
resGrp1.query();
if(resGrp1.next()){
resGrp1.active = true;
resGrp1.update();

 

can anyone help me on this, Thanks in advance.

5 REPLIES 5

Hi @Dharma5 

 

Can you show the Screenshot of your Transform Map and onAfter Transform Script you have written.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023