Reading LDAP for a single user and populating sys_user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2013 08:45 AM
I'm attempting to do a single user update of the sys_user record. Click a button, it grabs the userid, does an LDAP query and then re-populates the sys_user record.
So far I have this as prototype code:
/* Query LDAP for a specific UserID */
var ldapServer = new GlideRecord("ldap_server_config");
ldapServer.addActiveQuery();
ldapServer.query();
while (ldapServer.next())
{
var ldap = new GlideLDAP();
ldap.setConfigID(ldapServer.getUniqueValue());
var env = ldap.setup();
var query = '';
var strUserId = "mfs7a";
var i;
query = "(sAMAccountName=" + strUserId +")";
var result = ldap.getMatching('',query,true,10);
while(test = result.next())
{
var longString = test.toString();
gs.print(longString);
}
}
Which works fine as far as getting the current record from LDAP. However, I'm at a loss on how to deal with the raw LDAP record. I could just brute force it, chop up the strings and insert them into the sys_user record but that seems very 'not service now'. Can I use a transform map or something similar here to just map the values into the user record? If so, how would I do that?
Martan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2018 03:28 PM
Did you find a solution to this?
I am trying to do something similar.
the ldap.load function seems to do nothing,. =(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2018 07:32 AM
I opened a HI ticket. Apparently the GlideLDAPUsers ldap.load() function (and the associated UI action) does not work if you are using a mid server.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0621870
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2019 08:12 AM
Can GlideLDAPUsers query by a different field? We need to query by employee_number corresponding to the LDAP employeeid field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2013 12:48 PM
sorry, duplicate post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2013 12:49 PM
duplicate post