0 votes

When multiple people are included in an approval request, is there a way to email other potential approvers when someone approves or rejects a request? For example, if 3 people can approve the request and one approves - email the other two that action was taken and what it was?

by (420 points)

1 Answer

0 votes
by (305k points)
selected by
Best answer

Hello,

Yes, it is possible. You need to create a Business Rule triggering After Updating a Approval Request. To create the rule:

  1. Launch Adaxes Administration Console.

  2. Right-click your Adaxes service node, navigate to New and click Business Rule.

  3. On step 2 of the Create Business Rule wizard, select Show all object types and then select ApprovalRequest.

  4. Select After Updating a ApprovalRequest and click Next.

  5. Click Add Action and select Run a program or Powershell script.

  6. Enter a short description and paste the script below into the Script field.

     # E-mail settings
     $subject = "Approval request has been processed" # TODO: modify me
     $reportHeaderTemplate = "<h2>Approval request has been processed</h2>
     <ul><li>Operation: {0}</li>
     <li>State: {1}</li>
     <li>Processed by: {2}</li></ul>"
     $reportFooter = "<hr /><p><i>Please do not reply to this e-mail, it has been sent to you for notification purposes only.</i></p>" # TODO: modify me
    
     if ($Context.TargetObject.ApprovalState -eq "ADM_APPROVALSTATE_PENDING")
     {
         return
     }
    
     # Get approvers
     $approversInfo = $Context.TargetObject.GetApproversInfo()
     $approvers = $approversInfo.GetApproversEx($Context.TargetObject.Requestor, $Context.TargetObject.TargetObject)
    
     # Get approval request info
     $processedBy = $Context.TargetObject.ProcessedBy
     $approverName = $Context.GetDisplayNameFromAdsPath($processedBy.AdsPath)
     $operationDescription = $Context.TargetObject.DescriptionOfOperationToApprove
     switch ($Context.TargetObject.ApprovalState)
     {
         "ADM_APPROVALSTATE_APPROVED"
         {
             $state = "Approved"
         }
         "ADM_APPROVALSTATE_DENIED"
         {
             $state = "Denied"
         }
         "ADM_APPROVALSTATE_CANCELED"
         {
             $state = "Canceled"
         }
     }
    
     # Build mail
     $reportHeader = [System.String]::Format($reportHeaderTemplate, @($operationDescription, $state, $approverName))
     $html = $reportHeader + $reportFooter
    
     foreach ($approver in $approvers)
     {
         # Exclude initiator
         if ([Guid]$approver.Get("ObjectGuid") -eq [Guid]$processedBy.Get("ObjectGuid"))
         {
             continue
         }
    
         # Get email address
         try
         {
             $to = $approver.Get("mail")
         }
         catch
         {
             continue
         }
    
         # Send mail
         $Context.SendMail($to, $subject, $NULL, $html)
     }
  7. Click OK and then click Next.

  8. Click Add and double-click All Objects.

  9. Click OK and then click Finish.

Related questions

0 votes
1 answer

Dear Is it possible to change the values of a custom attribute (adm-CustomAttributeTextMultiValue4) when selecting a value from another custom attribute (adm-CustomAttributeText1). For ... , 2Latijn, 3Latijn, etc... Is this possible? Sincerly Hilmi Emre Bayat

asked Aug 26, 2019 by hilmiemrebayat (120 points)
0 votes
1 answer

We have a rule setup that when a user requests membership into a group it will email approvers of the group for approval. I would like to create a report that sends out a list of ALL approvers for every group we have approvals setup for.

asked Dec 18, 2023 by jujones79 (20 points)
0 votes
1 answer

Hello, Do you have some references of customers using MIM or other products as identity's source ?

asked Jun 9, 2021 by pierre.saucourt (40 points)
0 votes
1 answer

I have found the script to force membership updates for all rule based groups, but is there a script to force update a specific rule based group? I am looking to add a ... I would like to trigger a rule based group that adds members of the manual group. Thanks

asked Jul 9 by msheppard (840 points)
0 votes
1 answer

Hello, is it possible to update a user attribute (extensionAttribute5) with the name of the group (Name), the user was just added to? Example: In Group A gets a new ... A should be written in the attribute extensionAttribute5 of User A. Can you please help me?

asked Jun 27, 2023 by lohnag (160 points)
3,742 questions
3,420 answers
8,641 comments
1,390 users