How to create a Dynamic Variable for Home Telephone Field in AD (Active Directory).
It may be desirable to obtain specific information from the user account in AD in order to create a dynamic variable and subsequently to use that variable in an element being run by the main engine of the script.
This article illustrates how to create a dynamic variable which will resolve to the data that is contained in the Home telephone number field of a user account in Active Directory.
Create a dynamic variable based on information obtained from a user account in Active Directory.
The variable must first be defined in either a Global definitions file (illustrated below) or a profile specific definitions file (select Profile ->Edit -> Definitions tab) in order to be processed for use during the execution of the main engine.
Example of a global definitions file entry to create a variable named $homePhone
Syntax from screenshot above:
$slADCurrentUser = GetObject($LDAP)
If not @error
$homePhone = $slADCurrentUser.homePhone
Once the variable has been defined in a definitions file, it can be used in any element because the definitions file is always processed prior to elements in the main engine. To test to see if the variable resolves properly, create a message box element to validate for the test user and simply enter the newly created variable in the body of the message box similar to the following:
This is my home telephone number $homePhone
Note: The creation and use of dynamic variables is considered to be custom scripting and is therefore not supported. This article was created as a service to our customers to demonstrate the extensibility of the product for those who are inclined to create their own custom variables.