Hello Harry,
To accomplish the task, you need to:
- Create Custom Command that runs the necessary script for a user account
- Create Business Rule that runs the Custom Command after updating the Secretary attribute of a user
- Create Scheduled Task that runs the Custom Command on a periodical basis
- Add a value reference for the attribute where the script saves the LDAP filter to your Home Page Action configuration.
i. Create Custom Command that runs the necessary script for a user account
First, you need to create a Custom Command that runs the script. Then, you can execute the command using Business Rules, Scheduled Tasks and other Custom Commands. Thus, a command is a good way to have the script in one place only in case if you need to change something in it in the future.
To create the command:
- Create a new Custom Command.
- Since, most probably, you are not going to execute the command manually, you may want to clear the Enabled option on Step 1. This will create the Custom Command in disabled state. Disabled commands are not visible anywhere in Adaxes UI, but can be used in Business Rules, Scheduled Tasks and other Custom Commands.
- On Step 2, select the User object type.
- On Step 3, add the Run a program or Powershell script action and paste the following script from our script repository: http://www.adaxes.com/script-repository ... s-s488.htm.
- In the script, $propertyForLDAPFilter specifies the name of the attribute that will be used to store the LDAP filter in each user account. We suggest using one of Adaxes custom attributes, e.g. CustomAttributeText1. Such attributes are virtual. They are not stored in AD, but can be used the same as any other attributes of AD objects.
- Enter a short description and click OK.
- Click Next, then click Finish.
ii. Create Business Rule that runs the Custom Command after updating the Secretary attribute
Now, you need to create a Business Rule that automatically updates the filter once the Secretary attribute is updated. To do this:
- Create a new Business Rule.
- On Step 2 of the Create Business Rule Wizard, select User and After Updating a User.
- On Step 3, add the Execute a Custom Command action.
- Click Select and select the Custom Command you created on step i.
- When done, click OK 2 times, then click Next
- On the final step, add All Objects to the Activity Scope of the rule.
- Click Finish.
iii. Create Scheduled Task that runs the Custom Command on a periodical basis
Also, you need to create a Scheduled Task that updates the filters on a periodical basis to keep them in line with changes in AD. To do this:
- Create a new Scheduled Task.
- On Step 3 of the Create Scheduled Task Wizard, select User.
- On Step 4, add the Execute a Custom Command action.
- Click Select and select the Custom Command you created on step i.
- When done, click OK 2 times, then click Next
- On the final step, add All Objects to the Activity Scope of the task.
- Click Finish.
iv. Add a value reference for the attribute where the script saves the LDAP filter to your Home Page Action configuration.
Now, to use the filters in your Home Page action, you need to type a value reference for the attribute you used in $propertyForLDAPFilter (step i.5) as the filter value for selecting Organizational Units in your Home Page Action configuration.
Before testing, run the Scheduled Task at least once and wait until it completes.