0 votes

In a custom command where an approval is added in Powershell code ($Context.SubmitForApproval) or as an action ‘Send this operation for approval’ how can you run specific action/code if the approval is Denied?

Example; If approval is denied a mail is sent to requestors manager and requestors account is disabled.

by (20 points)

1 Answer

0 votes
by (288k points)

Hello,

It can only be done using a business rule triggering After updating a ApprovalRequest. Pay attention that the target object of the business rule is an approval request itself.

image.png

0

How do I map the approval request in the business rule to the action that requested the approval. What property or attribute in the approval (denied) can be linked to the original action.

map approval denied to original action.png

In step 1 I get an ticketID from the external system. If the action is denied I need to update an object with that ticketID.

0

Hello,

Unfortunately, there is no possibility to map the actions. If the ticketID is saved to a user property, you can obtain the ID using a script like below.

$propertyName = "description" # TODO: modify me

$targetObject = $Context.TargetObject.TargetObject

try
{
    $propertyValue = $targetObject.Get($propertyName)
}
catch
{
    $Context.LogMessage("Property $propertyName is empty.", "Information")
    return
}
0

One problem might be that the TargetObject is not created since the approval was denied.

Can one creative way be to use a custom script parameter as identifier between approval and action. Match $request.DescriptionOfOperationToApprove to that parameter.

If so, is there a way by Powershell SDK to set an action parameter, some method to $context. Or should I split the actions.

  1. Get external data and ObjectID
  2. Initiate custom command with argument of ObjectID as parameter (that can be found in $request.DescriptionOfOperationToApprove)
0

Hello,

Unfortunately, there is no such possibility.

Related questions

0 votes
1 answer

Hello, We have a script that checks for expiring accounts (temp/contractor) and emails the users manager requesting that they respond to the email either approving an extension of the ... has expired, or at least send an email to the security group to do so.

asked Mar 11, 2013 by DFassett (710 points)
0 votes
1 answer

Hi team, I have a business rule which is triggered, after an approval request was updated. Is it possible to read the reason somehow (if entered by the ... possible to run these actions only against specific approval or commands which create approvals?

asked Oct 1 by wintec01 (1.5k points)
0 votes
1 answer

HI, I have scenario to perform a custom action based on the notification approval result. Before creating a user, i need to send out for an approval, if the request ... there a way we can achieve this. Any help/pointers or references would really appreciated.

asked Mar 4, 2016 by ramd123 (50 points)
0 votes
1 answer

I have have admin rights and am in the "Request Approvers" group. I have a dearth of old approval requests to delete. I saw I could not delete them until I denied them ... says I have "No approval requests." How can I delete these denied entries? Thanks, Scott

asked Feb 26, 2021 by chappyshi (90 points)
0 votes
1 answer

I previously had access to this area but when I now look at the area I can see All Requests > Pending but not My Requests or My Approvals. when I attempt that I get the ... accessing. I've asked our other Admins and no one has made changes as far as I know.

asked Feb 21, 2018 by AlanWJ (150 points)
3,541 questions
3,232 answers
8,225 comments
547,802 users