How to update records in target table using transform map

Priya75
Tera Contributor

Hi All,

 

I want to update records , I am using coalesce on name field but i want to update only active records in target table.

how can i achieve that. I am using  before transform script ,but it is not updating the records where active is true and name field has a duplicate(one as active=false).

 

 

if(action == "insert"){
ignore = true;
}

if(action=="update" && target.active == true){
action="update";

}

 

 

17 REPLIES 17

@Priya75 

then it should update only the active record as per the onBefore transform script

Can you share your field maps?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

field maps has only 2 fields , one is name is a string field and another field is internal/external(dropdown), so we are updating on the basis of name. i have used it earlier it updated all the records. but some of the active false record as well, so now i m trying to validate it before the insertion.

 

@Priya75 

as per onBefore transform script I shared it should update only the one which is active=true

did you add logs and check what's the value of target.active in onBefore transform script

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

if(action == "update" && target.active.toString() == 'false'){
		ignore = true;
	}

if i use this then it is not going inside the if condition, if i remove update part and only write target.active is true , then i am getting logs that target.active= false, where as i have 2 records present in  the list.

 

@Priya75 

did you check what's the action when you print in logs?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader