LDAP Users Import to Update/Clear fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 10:15 AM
Hi all,
We are using LDAP to import users from AD into ServiceNow for a year now. Everything was looking fine.
We just released some service catalog items that requires manager approval and the issues are showing up now regarding LDAP user importing.
We have 2 different classes of users: regular employee and contractors.
The manager field for contractors was always in blank for AD users, as they are managed in another internal system.
So, when we started using ServiceNow last year, a custom attribute was created in AD users account to have the approvals being directed correctly in ServiceNow to those contractor manager's.
The problem is that when a contractor is converted into regular employee, LDAP fills the Manager field with the current manager's name but is not clearing the custom field Contractor Manager. The approvals are being sent to the wrong person.
See above, both fields not empty.
Below is the script to map the custom AD attribute to the custom field in ServiceNow:
Is there anything that could be done to have LDAP update users information correctly?
Was thinking in add the ELSE below, but not sure if will work.
Any clue?
answer = (function transformEntry(source) {
if(source.u_atccontractormanager){
var getManager = new GlideRecord('sys_user');
if(getManager.get('user_name',source.u_atccontractormanager)){
return getManager.sys_id;
}else{
source.u_atccontractormanager = '';
}
}
return "";
})(source);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 10:28 AM
I would probably just create a before BR (Business Rule) that says if the Manager field changes from empty, clear out the Contractor Manager field. Should be a simple fix since the AD object won't have a true value for the custom attribute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 10:44 AM
Would you do that on the User [sys_user] table or the Ldap Import table?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 10:52 AM
The sys_user table since you're trying to clear the value from a user record when the import happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 02:23 PM