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.

Script repository

Check the approval request initiator

May 18, 2021 Views: 893

The script returns true if the specified user or scheduled task is the initiator of the target approval request. To execute the script, create a scheduled task or business rule configured for the ApprovalRequest object type. The script should be executed in the If PowerShell script returns true condition.

In the script, the $requestorToCheckDN variable specifies the distinguished name (DN) of a user or scheduled task that should be the approval request initiator for the condition to be met. For information on how to get an object DN, see Get the DN of a directory object.

Edit Remove
PowerShell
$requestorToCheckDN = "CN=Bill Smith,OU=Users,DC=company,DC=com" # TODO: modify me

# Get requestor GUID for comparison
$requestorToCheck = $Context.BindToObjectByDN($requestorToCheckDN)
$requestorToCheckGUID = [Guid]$requestorToCheck.Get("objectGUID")

# Get requestor guid
$requestorGUID = [Guid]$Context.TargetObject.Requestor.Get("objectGUID")

$Context.ConditionIsMet = $requestorGuid -eq $requestorToCheckGUID
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers