You can use lookups within your projects to find values in the OU you are currently connected to or in a different OU.
Note: LOOKUPA & LOOKUPB functions are disabled for the
Group Members
connector. However you can use the drag and drop lookup if it is required.
If we take an example where you have managers stored in a separate OU to general users and you want to link the users to their corresponding manager.
To do this will need to lookup and return the distinguished name from your Manager OU.
You can do this using calculated columns and a LOOKUPB
expression. We are going to use LOOKUPB
as AD is our target, if AD was our source we could use LOOKUPA
.
LOOKUPB
has the following syntax:
object LOOKUPB(string column, FROM(from), keyValue)
object LOOKUPB(string columnName, LFROM from, params KVAL[] keyValues)
To lookup a manager in another OU you would use a lookup expression similar to:
LOOKUPB("DS-DN", "LDAP://OU=Managers,DC=demo,DC=simego,DC=com", WHEN("DS-SAMAccountName", Manager))
The quoted "DS-DN" is the column we are looking to return from Active Directory. This is the distinguished name of the manager.
We then specify the LDAP Path to the OU we want to look for the record in.
Then we specify a WHEN
clause to define what the parameters are that need to be matched. This is the link between the source and the target. In this example is it the Display Name of the Manager in Active Directory to the Manager Field in the source columns.
This could also be achieved using employee numbers if that is what is returned for your Source Manager column.
LOOKUPB("Distinguished Name", "LDAP://OU=Managers,DC=demo,DC=simego,DC=com", WHEN("EmployeeID", Manager)
If we take the same example as above, needing to lookup managers and link them to the user accounts being added, we can do this in a similar way. As our managers and users are all stored within the same OU, we can leave the LDAP path blank so that it uses the current connection.
Your lookup expression will be similar to:
LOOKUPB("DS-DN", "", WHEN("DS-SAMAccountName", Manager))
The quoted "DS-DN" is the column we are looking to return from Active Directory. This is the distinguished name of the manager.
We then leave the LDAP Path empty so that it uses the path we are currently connected to.
Then we specify a WHEN
clause to define what the parameters are that need to be matched. This is the link between the source and the target. In this example is it the Display Name of the Manager in Active Directory to the Manager Field in the source columns.
This could also be achieved using employee numbers if that is what is returned for your Source Manager column.
LOOKUPB("DS-DN", "", WHEN("EmployeeID", Manager)
If your lookup is not returning results, your manager may not exist in your active directory yet. If this is the case you can run the project again and it will set the manager field as an update item once the manager exists in AD.