LDAPUtils
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2012 10:17 AM
I came across the LDAPUtils script and the setManager function in there.
setManager: function(source, target) {
var ge = source.getElement(this.manager);
if (!ge || ge.isNil())
return;
this._getLdapUserUpdate();
var ldap = new Packages.com.glide.sys.ldap.LDAPUserUpdate();
var mid = this.ldapUserUpdate.getManagerValue(target, ge.toString());
if (mid == null)
return;
target.manager = mid;
},
Can anyone please help me in understand the the lines after this._getLdapUserUpdate()..
Thanks,
Ravali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2012 12:55 PM
Rhino is the product ServiceNow uses to implement the connection of Java and JavaScript. LDAPUserUpdate is a Java class that is being accessed by JavaScript. It has the utilities necessary to map the manager based on the LDAP source's manager entry. It's mapping the DN of the manager to an actual user on the ServiceNow user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2012 02:52 PM
Thanks Tony for the reply. Where can I find some more information on the LDAPUserUpdate class and its methods?
And do you have any idea about the last 5 lines in the script above?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2012 09:28 AM
when you see Packages, it generally indicates something that hasn't yet been turned into a proper API suitable for general access.
LdapUtils itself is written solely for the LDAP Support plugin.
What is it in the 'last 5 lines' that you're trying to understand? The getManagerValue() call? That appears to just be operating on target (assumed to be a "sys_user" GlideRecord), and the name of the previously set 'manager' field (this.manager, set with setManagerField()), returning a sys_id of a sys_user record identified as the target user's manager.
If you're trying to understand how to use it, then the "LDAP User Import" and "LDAP Group Import" table transform maps look like good ones to consult.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2012 09:49 AM
Hmm what I am understadnign here is that, this script here is responsible for updating the value from source (AD) to the target (user glide record).
So please help me in understanding each line of the script written here if possible: I never worked with LDAP utils so it is becoming tought to understand as there is no documentation available online as well.
----
setManager: function(source, target) {
var ge = source.getElement(this.manager); // getting the value from SD//
if (!ge || ge.isNil()) //checking if its not found or nil//
return;
this._getLdapUserUpdate(); // update to the user glide record//
var ldap = new Packages.com.glide.sys.ldap.LDAPUserUpdate();// ?//
var mid = this.ldapUserUpdate.getManagerValue(target, ge.toString());// ?//
if (mid == null)// ? //
return;
target.manager = mid; // ? //
},
----
Thanks,