Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Ignore a field when the value is not a serial number in a transform map

Adam Wood
Tera Contributor

Hi 

I have a issue where serial numbers are been overwritten by blank values when running a transform

e.g.

CI has serial number 'abc' 

Import Set has nothing in the serial number 

Transform runs

CI serial number is blank 

 

What is best way to Skip\Ignore the transform from overwriting the value. However, I still want the other fields to update and not to skip the full row. I don't think its an Empty field as I have the 'Copy empty fields' unticked. 

 

8 REPLIES 8

Hi @Ankur Bawiskar 

 

I have done this and it has stopped overwriting the serial field with a blank value.

However, now when a serial number is present in the import set it does not update the serial number. 

The name of the filed on the import set is u_serialNumber. i updated your script to: 

 
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
 
// Add your code here
if(global.JSUtil.notNil(source.u_serialNumber)){
target.serial_number = source.u_serialNumber;
}
 
})(source, map, log, target);
 
Thank you 
Adam
 

@Adam Wood 

Glad to know.

it should update actually.

Are you sure the serial number on target is not getting overriden with some other value because of some BR etc

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

@Ankur Bawiskar 

There is nothing else interacting with the serial field

Thank you 

@Adam Wood 

any update to this?

 

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