0 votes

I need to check EmployeeID when creating a user. In a simplified algorithm, EmployeeID must have six digits and the last two digits must be the sum of first two digits and second two digits (i.e. xx+xx=xx). If the EmployeeID does not correspond to these requirements, I want an error to be displayed and the user is not created.

As far as I understand, I cannot do this using a regular expression in a property pattern. Is there a way I can do this via Adaxes?

by (150 points)

1 Answer

0 votes
by (216k points)

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.

0

Thanks a lot for your answer!

0

Here is a tutorial on how to validate user-entered data with scripts: Validate/Modify User Input Using a Script.

Related questions

0 votes
1 answer

We are in need of a script to check for unique employeeID prior to creating account and upon failure email the service desk with results. Please advise.

asked Nov 3, 2017 by willy-wally (3.2k points)
0 votes
1 answer

We used to use a script to check if an AD user's MFA was set in Azure (Hybrid AD/AAD set up). I do not think it is relevant any longer. Is there another script that handles this or some other functionality in order to check a user's Azure MFA status?

asked Aug 23 by msheppard (130 points)
0 votes
1 answer

We're a new customer coming from ManageEngine and looking to use the password self service portal of Adaxes, I searched the Q&A and Scripts but didn't see anything ... lose this functionality. Can Adaxes do this with any sort of script setup or functions?

asked Aug 3, 2023 by curtisa (290 points)
0 votes
1 answer

and script is but nothing is happeneing. my user in adaxe browwser has the attribute to yes

asked May 10, 2023 by fjacques (20 points)
0 votes
1 answer

I want to check if an alias exists in google via using a GAM command before user creation. So far Create a "Before User Creation" Business Rule with the condition ... work once is on the Before User Createion Business Rule. Anybody doing something similar.

asked Aug 26, 2022 by dotz8 (20 points)
3,537 questions
3,227 answers
8,219 comments
547,728 users