Script repository

Check combination of property values

Updated on: Jan 18, 2026, Views: 2346

Property validation

The script checks whether the value of one property matches the value allowed for another property. For example, using the script, you can check whether a city and a country can be used together. The script should be executed in the If PowerShell script returns true condition in a business rule triggering Before updating an object. If the property values do not match, the script returns true.

Parameters

  • $firstPropertyName - the LDAP name of the first property to check.
  • $secondPropertyName - the LDAP name of the second property to check.
  • $propertyMap - maps values of the first property with values of the second property. The script returns true if values of the properties do not match the mapping.
$firstPropertyName = "c" # TODO: modify me
$secondPropertyName = "l" # TODO: modify me

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

# Get first property value.
$value1 = $Context.GetModifiedPropertyValue($firstPropertyName)

if ([System.String]::IsNullOrEmpty($value1))
{
    $Context.ConditionIsMet = $False
    return 
}

# Get second property value.
$value2 = $Context.GetModifiedPropertyValue($secondPropertyName)

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

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.