Automatically Set Users' Address Based on Their Office
Very often, when creating or updating users in Active Directory, one has to fill in the same address information for different users. In this tutorial, you will learn how to configure Adaxes to automatically update the user address fields based on the user's office, and how to enable selection of offices from a drop-down list.
In this tutorial, we will modify the built-in Property Pattern called User Pattern to allow users to select values for the Office property from a predefined list. Then we will create a Custom Command that will update the user address information based on the value of the Office property of the user account. Then we will create two Business Rules to automatically execute this Custom Command after a new user is created and after the Office property of an existing user is updated. Also, we will create a Scheduled Task that will execute this Custom Command to update the user address information periodically (on a regular schedule).
Allow Users to Select Office from Drop-Down List
To allow users to choose an office from a drop-down list:
Adaxes service \ Configuration \ Property Patterns \ Builtin and select User Pattern.
- Click the Add button located in the top right corner of the view.
- Select the Office property in the drop-down list.
- Enable the Must be one of the following values only option.
- Click the Edit button located next to this option.
-
In the Edit Value List dialog that opens, click Add to add office names
to the list.
If you want to force users to fill in the Office field, enable the The property is required option.
- When finished, click OK.
Create a Custom Command to Update User Addresses
To create a Custom Command that will update the user address information:
If you don't want the Custom Command to be available in the user interface, uncheck the Enabled check box (recommended).
Click Next.
- Click Add Action.
- In the dialog that opens, select the Update the User action.
-
Click the Add button located in the Action Parameters section.
-
Select the Country Name property in the Property to modify combo box and
type the name of the country where an office is located in the New value field.
- Click OK
-
Perform the last steps for the following properties:
- State/Province
- City
- Street Address
- P.O.Box
- Zip/Postal Code
- Click OK.
- Right-click the action/condition set.
-
Select the
Add Condition
item in the context menu.
- In the dialog that opens, select the If <property><relation><value> condition type.
-
In the Condition Parameters section, specify Office equals Office A.
- Click OK.
Add action to a new set link and repeat steps 4 and 5 for the rest of the offices.
Automatically Execute the Custom Command on User Creation and Modification
Now we need to configure Adaxes to automatically execute the Custom Command when a new user is created and when the Office property of an existing user is modified.
Run PowerShell Script after Creating a User.
Update User Addresses on Schedule
In order to update the address information of the users that were created or modified outside of Adaxes,
you can create a
Scheduled Task that will periodically
execute the Custom Command.
