Script repository

Check if the property is empty before modification

Updated on: Jan 18, 2026, Views: 1713

Property validation

The script checks the property being modified and returns true if it is currently empty. To execute the script, use the If PowerShell script returns true condition in a business rule triggering Before updating an object.

In the script, the $propertyName variable specifies the name of the property to check.

$propertyName = "employeeID" # TODO: modify me

try
{
    $currentValue = $Context.TargetObject.Get($propertyName)
}
catch
{
    $currentValue = $NULL
}

$Context.ConditionIsMet = [System.String]::IsNullOrEmpty($currentValue)

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.