Using the Coalesce Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 09:19 AM
I am working on LDAP and trying to get the proper fields from my Active Directory field to come into the user records within service-now and I have since went back and added the field of employeeid to match within a field called employee number in the user record. The field map that I am coalescing on now is the samaccountname to user_name.
My question is that when I set the system to coalesce also on the employeeid as well as the samaccountname and then I run the scheduled load it will create all new record and import the user employeeid as designed, what I really want the system to do is if the samaccountname is found to coalesce as designed and not create a new record. I found this on the Wiki:
To only update records where a match is found, and skip records where a match is not found, specify a coalesce field and add the following script to the transform map.
if (action == 'insert')
ignore = true;
but not really sure where I should add it within the transform map. Here is the current script that I have within the transform map:
//
//the manager coming in from LDAP is the DN value for the manager.
// The line of code below will locate the manager that matches the
// DN value and set it into the target record. If you are not
// interested in getting the manager from LDAP then remove or
// comment out the line below
ldapUtils.setManager(source, target);
//
// Set the source LDAP server into the record
target.ldap_server = source.sys_import_set.data_source.ldap_target.server;
// Sets the Domain Field based on Source
if (source.u_source.indexOf("DC=AP") >= 0){
target.u_active_directory_domain = 'AP';
}
if (source.u_source.indexOf("DC=EU") >= 0){
target.u_active_directory_domain = 'EU';
}
Based off the recommendation on the Wiki, I should add this to that script?
if (action == 'insert')
ignore = true;
Where would I add this and is there any more syntax that I should include?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 11:30 AM
You want to create your own, new onBefore Transform Script that runs that code. It must be an onBefore script in order to have the ignore flag evaluated BEFORE the record is created.
if (action == 'insert') {
ignore = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 11:36 AM
so does that mean by creating the OnBefore script it will not create new records if the employee number is not located within the Active directory source feed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 12:05 PM
Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 12:11 PM
and if the employee number is in fact in the ad record, it will then coalesce based off of the user_name that the record is coalescing on already?