Script repository

Remove user stored in DN syntax property from approvers list

Updated on: Jan 18, 2026, Views: 4063

Approval requests

The script removes a user stored in a DN syntax property from the approvers list of all pending approval requests awaiting actions from the target user. To execute the script, create a business rule, custom command or scheduled task configured for the User object type.

In the script, the $approverDNProperty variable specifies the name of the property storing the approver to remove.

$approverDNProperty = "assistant" # TODO: modify me

# Get the approver DN.
try
{
    $approverDN = $Context.TargetObject.Get($approverDNProperty)
}
catch
{
    $Context.LogMessage("Property '$approverDNProperty' is empty", "Warning") # TODO: modify me
    return
}

# Get all requests awaiting user approval.
$requests = $Context.TargetObject.GetApprovals("ADM_APPROVALSTATE_PENDING")
if ($requests.Length -eq 0)
{
    return
}

# Bind to the approver.
$approver = $Context.BindToObjectByDN($approverDN)

foreach ($requestID in $requests)
{
    # Bind to the request.
    $requestGuid = [Guid]$requestID
    $path = "Adaxes://<GUID=$requestGuid>"
    $request = $Context.BindToObject($path)
    
    # Get approvers info.
    $approversInfo = $request.GetApproversInfo()
    $approverTrustees = $approversInfo.ApproverTrustees
    if (-not($approverTrustees.IsApprover($approver)))
    {
        continue
    }
    
    # Remove the approver
    $approverTrustees.Remove($approver)
    
    # Update the approvers list.
    $request.SetApproversInfo($approversInfo)
    $request.SetInfo()
}

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.