How to query an LDAP user record in Script

Simon T
Kilo Contributor

Hello

We have an LDAP integration for user authentication and single sign-on login.

I would like to query the other LDAP user attributes that we import in a server side script using   ( gs.getUserName() as the query param) .

Can someone tell me how this can be done if possible in script?

I was think something along the line of:

var ldap = new GlideLDAPUsers();


ldap.load( gs.getUserName() );

...

But got no further...

 

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Simon,

have a look at this documentation, it will help to find the other user attributes to be used in your script:

LDAP transform maps

Hope this will be useful for you.

Please, remember to mark Correct or Helpful if you find my response useful.

Cheers
Alberto

View solution in original post

6 REPLIES 6

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Simon,

have a look at this documentation, it will help to find the other user attributes to be used in your script:

LDAP transform maps

Hope this will be useful for you.

Please, remember to mark Correct or Helpful if you find my response useful.

Cheers
Alberto

Hi,

Any update on this?

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thanks you

Cheers
Alberto

Hi Alberto

I actually found what I needed via simpler route in our implementation:

var gr = new GlideRecord('ldap_import');
var filter = "u_samaccountname=" + gs.getUserName();

...


var empNo = gr.getValue('u_extensionattribute3');

 

Thanks

Good to know Simon,

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thanks you

Cheers
Alberto