Showing results for 
Search instead for 
Did you mean: 

Cisco Community Designated VIP Class of 2020


Query AD from a UCCX script

Does anyone know how to query Active Directory from a UCCX script?  Looking to pull the caller's email field from the ANI.


HiYou can do this, but it's


You can do this, but it's not so simple. Two options:

1) Create a custom java class to read LDAP and return the info you require

2) Implement a middleware web server that you can call from UCCX, that would take ANI as a parameter and return the email address.

I've done 1) before, or something very similar...


Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

Just watch out for what the

Just watch out for what the failure mode is, if the query doesn't return. I've had something similar where the AD server didn't respond (due to patching) and the calls were then having large wait times before being placed into the CSQ.

AD resilience in general is a pain...


Hi. Take a look at this.G.

Hi. Take a look at this.



Hey Aaron and Gergely,    

Hey Aaron and Gergely,

     Thanks to you both for your replies.  Sorry I didn't update sooner.  I'll give these suggestions a shot and post back.

Hello Joe, Do you managed

Hello Joe,


Do you managed integration script uccx with AD?

If yes, send me please.


Hi renatobandeirapereira1,   

Hi renatobandeirapereira1,

     No, I didn't get it to work and never revisited it.  Sorry.


This discussion is pretty old

This discussion is pretty old now, but I'm forced to revisit it now as I have to get this working.  I need to query AD to pull the email address of internal callers based on ANI.  I've read Gergely's post and tried using some of the things in it to accomplish what I need but am not having any luck because I don't know what the heck I'm doing and this forum is the only resource I have available to ask for assistance.  So, if anyone has any wisdom to share on how to query AD from script variables, and return query results back into a script variable, I'd very much appreciate it.  Please note that I'm not a Java developer. 

If you have Premium licensing

If you have Premium licensing it seems like you could do a SQL call to the domain controller and try and pull the email that way.

For compatibility sake may have to dump the AD data into a compatible SQL database first though and then query that DB.

That seems like the most down and dirty way to me without having to do anything with Java. The Java method seems like it would be the most fun though.


Thanks, Joshua.  I don't mind

Thanks, Joshua.  I don't mind doing Java, I just need some guidance.  I think everything I'd need to do it exists in Gergely's example, but I don't know what chunks of it to pull out and use in my script, nor how to pass from a variable to the java code and then the results back to a variable.


Joe, would you mind posting

Joe, would you mind posting the account details of a typical user in your AD structure? All I need to know is what fields contain the phone number and the email address. We'll have to use these fields in our LDAP query. I'll help you with the Java part. 



You have no idea how much I

You have no idea how much I would appreciate your help!  I really did try and tailor what you had done in your document to my situation, but after trying for a day and a half I came to the realization that I simply don't have enough knowledge to customize or get it to work for what I need.  So, the AD attributes where users ext and email address are populated are named telephoneNumber and mail.

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here