Script repository

Request approval for adding to a group from manager

Updated on: Jan 18, 2026, Views: 3993

Approval requests

The script submits the request to add an object to a group for approval. The manager or owner of the object will be set as approver. To execute the script, create a business rule triggering Before adding a member to a group.

# Bind to new member
$member = $Context.BindToObject("Adaxes://%member%")

try
{
    # Get manager DN.
    $approverDN = $member.Get("manager")
}
catch
{
    try
    {
        # Get owner DN.
        $approverDN = $member.Get("managedBy")
    }
    catch
    {
        # The new member has neither a manager, nor an owner 
        $Context.Cancel("Cannot add the object to the group because the object you are trying to add has neither a manager, nor an owner") # TODO: modify me
        return
    }
}

# Submit for approval
$Context.SubmitForApproval(@($approverDN), $False, $False, $False, $False)

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.