Video Screencast Help

Autocomplete and AD in workflow.

Created: 04 May 2011 • Updated: 12 May 2011 | 8 comments
Joe O'Neill's picture

I have a requirement to use the Autocomplete text box to search for users in AD. I have used the swat demo to do something similar with a search button. What I am trying to achieve is a simple look up of users. As the user types (after the third charachter) a list of matches appears below the field. I am sure there is a way of doing this, but I am struggling.

Discussion Filed Under:

Comments 8 CommentsJump to latest comment

dfnkt_'s picture

I'll look some more into this as soon as I can but I would probably say that using autocomplete against AD is going to be pretty slow. I've got a webforms project that's iterating over all my AD computer accounts and it takes a bit to populate the list so I'm not sure how responsive an autocomplete might be. Reecardo could probably shed a bit more light on it. 

I'm tied up right now debugging some JS on a workflow but I can look at it tomorrow morning.

dfnkt_'s picture

Ok I snuck this in and here's what I was able to determine.

I wasn't able to get AutoComplete against AD to work _at_all_ 

I did however get it working with a database really quickly. By using an autocomplete text box, configuring it to use an input on the FIRST_NAME column of my database (stores employee data), and setting the input to completion_prefix%  with a dynamic value setting.

You can see here it found several employees with the first name like 'cal%'

And here is my setup for the component itself.

I did not have to put this inside a dynamic update panel or make it post form on value change. Sorry I couldn't help out much with the AD piece.

Joe O'Neill's picture

Do you have the code to populate the SQL tables. Do you just purge and populate daily or do you look for changes ?

The ideal solution would be to have an up to date SQL table with ONLY relevant AD fields (First name, Last name, email, etc), it would be much quicker.

Aryanos's picture

I just finished doing something similar where I wanted users to be able to use the AutoCompleteTextboxComponent to search for the user. Here's a sample of what I did, you'll have to fill in your AD credentials in the Properties tab.

Basically I returned the display name of the users to populate the drop down and then found that AD info for that user. I added a filter to remove those accounts without emails and another to remove accounts that were disabled which you can remove.

There isn't a field in the Get Users With Details to do a search with the display name so I had to use the Additional Attributes in that component. Below is the video that Jason Short made regarding how to do a search for an AD field that isn't listed for that component. It is case sensitive so if you want to search for a different AD field you need to ensure it is correct.

Get Direct Reports

AD 965.61 KB

I like my beats fast and my bass down low

Joe O'Neill's picture

I'll take a look at your responses and see if i can make it work.

Joe O'Neill's picture

Got it working, thanks a lot. That's excellent. Especially in that it extends the fields you can display.

I have another challenge for you - as you know, searching a big AD, accross multiple containers, can take a wee while. I have seen a jscript example that has a swirling ball type thing, much like the thing you see when a MAC starts up. this appears at the end of the typeahead feild. This basicly informs the user that something is happening while the lookup is taking place. The current effect is a pause. The user has the temptaiton to hit enter thinking that something else is needed. I will try to do a screen cap for you.

Do youi know of any way of indicating that the AD lookup is actually underway ?

Thanks in advance.

Aryanos's picture

Never tried it but I understand what you're trying to do as the pause can take a while for the list to populate. Maybe one of the other developers with javascript knowledge can help you out with this as I'd like to see it implemented as well. Another thing you can do is add a label to the form as a disclaimer to wait for the list of names to popup to take action.

I like my beats fast and my bass down low

Joe O'Neill's picture

I was thinking maybe Ajax Label component would be the go. Unfortunately I don't have documentation for this component, or what it does. I thought maybe setting a value while the AD search was going on and then setting it back when the search was done. Then using some dynamic control set the visibility of the Ajax label control.

I just don't know enough about the product to make this work though. I had a crack at it, but it's a little beyond me at the moment. Without any documentation as to what the LabalControl is actually for, I just can't work it out.