0 votes

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 approver)?
  • Is it possible to run these actions only against specific approval or commands which create approvals?
by (1.5k points)
0

Hello,

If you have a business rule configured for the ApprovalRequest object type (e.g. triggering After updating a ApprovalRequest), you can obtain the reason for denying or cancelling the request using the below code:

$reason = $Context.targetObject.DenialOrCancelingReason

The below code will obtain the reason for approving a request:

$reason = $Context.targetObject.ApprovingReason

Is it possible to run these actions only against specific approval or commands which create approvals?

Sorry for the confusion, but we are not sure what exactly you mean. Please, describe the desired behavior in all the possible details with live examples.

0

Thanks for your answer.

I tested your shared script, and it has the same value for approving and denying a request.

I also found this variable, holding the same information.

adm-DenialOrCancelingReason

Sorry for the confusion, but we are not sure what exactly you mean. Please, describe the desired behavior in all the possible details with live examples.

Right now my business rules looks like this image.png

This means, it would be triggered against all approvals, no?

I would like to narrow down it further, so this should be only executed if an approval was initiated by either one specific custom command or business rule.

1 Answer

0 votes
by (287k points)

Hello,

I tested your shared script, and it has the same value for approving and denying a request.

Thank you for pointing out the issue. We forwarded it to the corresponding department for consideration.

Right now my business rules looks like this

Thank you for the provided screenshot. The business rule should work just fine.

This means, it would be triggered against all approvals, no?

Yes, that is correct.

I would like to narrow down it further, so this should be only executed if an approval was initiated by either one specific custom command or business rule.

Unfortunately, there is no such possibility.

0

Morning,

I am trying to achieve the following

  1. Helpdesk runs command to create a group, during the creation a ticket ID is asked and stored in adm-CustomAttributeText2
  2. Business rules kicks in before creation a group and send out approval
  3. Within the approval mail the ticket ID is correctly shown
  4. The approval get approved
  5. Business rules as above kicks in and I want to read the ticket ID in my PowerShell script

Issue: I am not able to retrieve the ticket ID currently

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Check if object is existing
    try {
        $targetObject = $Context.TargetObject.TargetObject    
    } catch {
        $Context.LogMessage("targetObject can not be set", "Error")
        return
    }

# Get approval state information 
    $propertyName = "adm-CustomAttributeText2" 
    try{
        $propertyValue = $targetObject.Get($propertyName)
        $ticket = $propertyValue
        $Context.LogMessage("$propertyName is $propertyValue.", "Information")
    }catch{
        $Context.LogMessage("$propertyName is empty. Ticket can not be updated", "Warning")
        return 
    }

And I always get this image.png

0

Hello,

According to the screenshot, the target object of the operation that was submitted for approval has adm-CustomAttributeText2 empty, hence the warning. You need to make sure that the property is not cleared somewhere between group creation and the script execution.

0

Hi, yes ... but the value is never emptied.

The field is called "Please enter Ticket ID" image.png

Creation waiting for approval image.png

Approval email image.png

Creation after approved image.png

Object value after creation image.png

Is the way of getting this value during approval action correct?

0

Hello,

The script should work fine in business rules configured for the ApprovalRequest object type. Unfortunately, with all the information covered, we cannot provide any more insights on the behavior. As an option, you can send full screenshots and a detailed description of the workflow to us at support@adaxes.com.

Related questions

0 votes
1 answer

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 ... is denied a mail is sent to requestors manager and requestors account is disabled.

asked Mar 28, 2023 by Pihl (20 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 set up an action that must be approved by me. I have not received any notifications when I execute the action. Should I receive an email to approve? If so, what am I missing in order to receive the approval request?

asked May 25, 2022 by Tfarmer (160 points)
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

We have a New User action set up for our HR staff to use. There is a field in the custom form that states "Notes for IT Department". I want to display the data that is ... IT Helpdesk. I don't know what parameter this would be considered. How can I find out?

asked Feb 14, 2020 by slowllama (100 points)
3,533 questions
3,224 answers
8,216 comments
547,690 users