- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 02:47 AM
Hi,
I am struggeling with a transform script and I hope you can help me. The situation is that during an LDAP consolidation project two different LDAPs need to be imported into ServiceNow. The only possible coalesce attribute is email, however some accounts from the old LDAP should not be overwritten by the new LDAP import. All records that only exist in the new LDAP should, always be updated. I added a new attribute "LDAP_tempuser" to identify accounts that should be overwritten and I set up the following onBefore script to restrict the update process:
if (action == "update" && target.ldap_server != "newLDAP" && target.u_ldap_tempuser == false) {
ignore = true;
}
My expectation is that:
- If all conditions within the if clause are fulfilled, the record is ignored
- If any of the conditions within the if clause is not fulfilled, the existing record is updated
However, the transform ignores all records, regardless of the if statement above and I cannot see why. Any ideas?
The attached screenshot shows the intended logical flow if that helps.
Thanks in advance for your help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 03:24 AM
Hey Martin,
target.ldap_server is a reference field so "newLDAP" actually needs to be the sys_id of the newLDAP server you have created.
var ldap_server = "32424a11dbba22002686da94ce96194b"; // newLDAP
if (action == "update" && target.ldap_server != ldap_server && target.u_ldap_tempuser == false) {
ignore = true;
}
Right now, nothing is being inserted because that field would never equal "newLDAP".
Cheers,
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 04:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 04:43 AM
Thank you. It says "Row transform ignored by onBefore script". As the onBefore script I posted above is the only onBefore Script, something is wrong there. Any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 04:58 AM
Hi Martin,
Sorry, I don't see any wrong in your before transform map.
May be both the condition are satisified , so why ignored. To ensure put gs.log for the both the values.
if (action == "update" && target.u_ldap_tempuser == false) {
ignore = true;
}