Script Repository


Validate properties against each other

September 18, 2019
175

The script validates 2 properties against each other. For example, using the script, you can check whether a city and a country specified for a particular user can be used together. The script can be used in the If PowerShell script returns true condition of a Business Rule triggering Before updating/creating a user. The script returns True when values of the properties do not match.

Parameters:

  • $property1 - Specifies the LDAP name of the first property to check.
  • $property2 - Specifies the LDAP name of the second property to check.
  • $propertyMap - Maps values of the first proeprty with values of the second property. The script returns TRUE if values of the proeprties do not match the mapping.
Edit Remove
PowerShell
$property1 = "c" # TODO: modify me
$property2 = "l" # TODO: modify me

$propertyMap = @{
    "US" = "Washington", "New York", "Boston";
    "FR" = "Paris", "Marseilles", "Lyon";
} # TODO: modify me: "property1Value" = "Property2Value", "Property2Value", "Property2Value"

# Get value of property 1
$value1 = $Context.GetModifiedPropertyValue($property1)

if ([System.String]::IsNullOrEmpty($value1))
{
    $Context.ConditionIsMet = $False # Property 1 is not specified
    return 
}

# Get department
$value2 = $Context.GetModifiedPropertyValue($property2)

# Check department
$Context.ConditionIsMet = $propertyMap[$value1] -notcontains $value2

Comments ( 0 )
No results found.
Leave a comment