To check EmployeeID for new users as you described, you need a Business Rule that runs a PowerShell script BEFORE a new user is created.
If entered data is incorrect, this script must throw the CancelCommandException exception to terminate the operation.
Function IsEmployeeIDValid([string]$employeeID)
{
# Check the length of the value.
if ($employeeID.Length -ne 6)
{
return $False;
}
# TODO: validate the Employee ID. If not valid, return $False.
return $True;
}
if (-not (IsEmployeeIDValid(%employeeId%)))
{
Throw New-Object Softerra.Adaxes.CommandPipeline.CancelCommandException "The EmployeeID is invalid", $True
}
To create a Business Rule, click the icon New Business Rule on the toolbar of the Adaxes Administration Console, enter the Rule name, and click Next. Then, select the User object type and specify when to execute the Business Rule: click Before and Creating a User.
Click Next.
Click Add Action. In the dialog that opens, select the Run a program or script action and choose the PowerShell script type. Then, enter the script description and the script you need.
Click OK and then click Next. At the next step, assign the Business Rule to the locations, where you want it to be effective, and click Finish.