Transform map script to skip record for null field

tschenke
Giga Contributor

I am importing some software licenses into ServiceNow from another system. I have an import set created that imports the licenses from a spreadsheet. I have one transform map that imports the licenses and another that maps the entitled users. However, not every license has an entitled user while others may have multiples. I would like to create a script on the user transform that looks at the column where the entitled user's display name would be and if that cell is empty, not create an entitlement. Right now it is creating a blank entitlement. I am sure that this is a simple script but I am very new to javascript and I'm having issues getting it right. I will keep researching this and trying to figure it out but if anyone has a way of doing this, please let me know. I know that I can create another data source with only the info that it is looking for but I am trying to avoid the clutter of multiple sources. Thanks.

3 REPLIES 3

TJW2
Mega Guru

Use an OnBefore tranform script, substitute entitled user's field name for u_user_name
if (source.u_user_name.nil()){
ignore = true;
}


Thanks, It works perfectly.

tschenke
Giga Contributor

That seems to have worked perfectly. Thanks for the quick help.