FindUsersInAD()
FindUsersInAD() function returns users’ account names or any other values of a chosen Active Directory (AD) field for a given AD field name and its value.
Syntax
FindUsersInAD(ADFieldName, ADFieldValue); FindUsersInAD(ADFieldName, ADFieldValue, ADResultFieldName); FindUsersInAD(ADFieldName, ADFieldValue, ADResultFieldName, ADNames);
Function arguments
- ADFieldName – (String) a name of the AD field you are looking for;
- ADFieldValue – (String) a value of the AD field you are looking for;
- ADResultFieldName – (String) a name of the AD field that value is to be returned;
- ADNames – (String) a list of AD domain names (separated by comma or semicolon) in which system will search for a user. To search in all trusted domains use „all” value. By default it is the domain of AMODIT server.
Return value
This function returns String.
Returns users’ account names (logins) or values of the specified AD field, or an empty string if nothing has been found. If there are more than one value to be returned they will be separated with semicolon ’;’.
Examples
Example 1
This will return users’ account names which have 'EmployeeID’ AD field value equals '123′.
data = FindUsersInAD("EmployeeID", "123");
Example 2
This will return users’ account names which have 'EmployeeID’ AD field value equals to a value stored in the [ID] field on the case form.
data = FindUsersInAD("EmployeeID", [ID]);
Example 3
This will return values stored in the „EmailAddress” AD field which have 'EmployeeID’ value equals '123′.
data = FindUsersInAD("EmployeeID", "123", "EmailAddress");
Example 4
This will return values stored in the AD field which name is specified in the [WantedResult] case field which have 'EmployeeID’ value stored in the [ID] field on the case form.
data = FindUsersInAD("EmployeeID", [ID], [WantedResult]);
Example 5
This will return the login (default result) of the users which have 'EmployeeID’ value equals '123′. Users will be searched in two AD’s: company1.local and company2.local.
FindUsersInAD("EmployeeID", "123", "","company1.local;company2.local");
Example 6
This will return the login (default result) of the users which have 'EmployeeID’ value equals '123′. Users will be searched in all domains in the current domain forest.
FindUsersInAD("EmployeeID", "123", "","all");