Script Repository

Delegate approvals to assistants and secretaries

February 24, 2021

The script allows delegating the operations a user needs to approve to their assistants or secretaries. When run, the script adds a user's assistant or secretary as an additional approver of all pending requests that the user can approve.

To delegate approval requests, create a custom command that runs the script and run it on the user or users whose requests you want to delegate. To add the script to your command, use the Run a program or PowerShell script action.


  • $newApproverDNProperty - Specifies the property that contains the subtitle approver. Use assistant or secretary.
See Also: Remove assistants and secretaries from Approval Requests.
Edit Remove
$newApproverDNProperty = "assistant" # TODO: moidfy me

# Get the new approver DN
    $newApproverDN = $Context.TargetObject.Get($newApproverDNProperty)
    $Context.LogMessage("Property '$newApproverDNProperty' is empty", "Warning") # TODO: modify me

# Get all requests awaiting for approval by user
$requests = $Context.TargetObject.GetApprovals("ADM_APPROVALSTATE_PENDING")
if ($requests.Length -eq 0)
    return # No requests awaiting for approval by the user

# Bind to the new approver
$newApprover = $Context.BindToObjectByDN($newApproverDN)

# Add the new approver to each request
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()
    # Check whether the new approver is already an approver for the current request
    if ($approversInfo.IsApproverEx($newApprover, $request.Requestor, $request.TargetObject))

    # Add the new approver
    $approverTrustees = $approversInfo.ApproverTrustees
    # Update the approvers list

Comments ( 0 )
No results found.
Leave a comment