Elements Connect for Data Center

How to query multiple ou's

In this example, we tested our query on a test LDAP with the below structure (which will be the datasource for our Elements Connect field).

Elements Connect FAQ How To Query Multiple OU LDAP Structure.png

If the user wanted to query a specific OU, that would be simple, and could be achieved by using the below query in the Edit view of Elements Connect field.

The LDAP query will looks like: 

ou=people,dc=planetexpress,dc=com?uid,cn?sub?(objectClass=person) 

And the output will be:

Elements Connect  FAQ How To Query Multiple OU Filter one OU.png

Now, if the user wants to retrieve entities in both OU's, the query will be:

dc=planetexpress,dc=com?uid,cn,ou?sub?(objectClass=person)

You might wonder why the other entries didn't appear and that's because they don't have the "objectClass=person" attribute.

Elements Connect FAQ How To Query Multiple OU List  all users.png

Now, if we wanted to query multiple Ou's to retrieve all the entries where "ou=Accountant", the LDAP query should be something like:

dc=planetexpress,dc=com?uid,cn,employeeType?sub?(&(objectClass=person)(employeeType=Accountant))

And the result would be as shown in the below screenshot, knowing that "John A. Zoidberg" and "MacBook" are from two different OU's (as per our LDAP structure).

Elements Connect FAQ How To Query Multiple OU.png

This is a simple example which can adapted to match the client needs, for more complicated queries, it's always recommended to contact an LDAP administrator.