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.

Transform onBefore ignore record

Tom Siegel
Kilo Guru

I have built a custom Transformation Map for Microsoft Intune Computers. Some of the records coming over have no userPrincipalName and I want to ignore them. After doing some reading on the forum I decided to use an onBefore script to ignore these records. The logic seemed pretty straight forward so I implemented the below:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

// Add your code here
if (source.u_userprincipalname == '') {
ignore = true;

}

})(source, map, log, target);

I ran the import along with the Transform and yet there are records that have no userPrincipalName being updated by the import.

What am I missing?

 

Thanks,

 

Tom

1 ACCEPTED SOLUTION

Voona Rohila
Mega Patron
Mega Patron

Hi @Tom Siegel 

Try this

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

// Add your code here
if (source.u_userprincipalname.toString() == '') // check if field name is proper or not.
 {
ignore = true;
}

})(source, map, log, target);

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

2 REPLIES 2

Voona Rohila
Mega Patron
Mega Patron

Hi @Tom Siegel 

Try this

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

// Add your code here
if (source.u_userprincipalname.toString() == '') // check if field name is proper or not.
 {
ignore = true;
}

})(source, map, log, target);

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Rohila - Thanks for the help that makes more sense

 

Tom