Import set row transform ignored by onBefore script

jleyco
Mega Contributor

Hello!

Does anyone have any idea what could cause an import set row to ignore an onBefore script in the transform map?

Please see below screenshot. For the same record (but different row # in each night's import set), it is sometimes gets ignored by the onBefore script

find_real_file.png

8 REPLIES 8

Mark Stanger
Giga Sage

What do your 'onBefore' scripts look like within that transform map?


Hi Mark,



Please see below.



// Deactivate Disabled users


var dn = source.u_source.toString().replace("ldap:", "");




if (source.u_source.indexOf('OU=DPD') >= 0 || source.u_useraccountcontrol == '514') {


  if (action == 'insert' || target.active == false) {


          ignore = true;


  } else {


  gs.log('LDAP Import: Disabling user ' + dn);


  target.active = false;


  target.locked_out = true;


  }


}




// Ignore blank names


if (source.u_sn == "" || source.u_givenname == "") {


  ignore = true;


}


4 possibilities then based on this script...



1)   The LDAP record in question is part of the 'DPD' OU (or, perhaps more accurately, an OU with 'DPD' in the name) as indicated in line 5


2)   The LDAP record is disabled as indicated with the useraccountcontrol attribute '514 in line 5


--This (combined with the conditions below it) is desirable and basically means don't create an already-inactive user record in ServiceNow and don't update an already-inactive ServiceNow user record.


3)   The LDAP record has an empty last name (u_sn) as indicated in line 17


4)   The LDAP record has an empty first name (u_givenname) as indicated in line 17


--These are also both desirable checks because you don't want to modify ServiceNow user records in a way that creates blank names.



The only thing here that's custom or that you should potentially worry about is the check on the 'DPD' OU.   You'll have to look at the import set rows in question to determine if they meet any of the criteria I've listed above.


Hi Jessica,



May I know where did you find this business rule? Thank you. I encountered the same issue.



Regards,


Diane Miro