Powershell - Supply Approval Reason

Hi Team. 

I have a some Powershell that is setting a VA to TRUE. There is also an approval work flow on this VA. 

Is it possible via Powershell to supply the approval reason? 

  • Use the '-Reason' switch with Approve-QARSApprovalTask

  • Thinking a bit more about this, I am unclear on what you mean by "...to supply the approval reason?"

    The answer I provided below assumes that you want to programmatically approve the request but I am wondering if you mean something else.

    The reason for the request as supplied by the Initiator is stored in the Controls of the original Request.

    In this thread, you were shown how to extract the Controls from a Request.

  • Hi Johnny. 

    I have a workflow that has a Powershell script that is setting a VA to TRUE and there is another workflow that is watching for this VA to change to TRUE and do some tasks. In that work flow is an approval step. 

    I am getting an email to say the ARS service has submitted a request but it gives no details as to why. I was hoping to just provide some generic text really

  • "...setting a VA to TRUE "

    You could have that script that sets the VA or workflow send an OperationReason (or other Control name of your choice) that you could read back on the other end using a script - i.e.

    Set-QADUser -identity $User -objectattributes @{MyVA=$True} -Control @{MYARControl="This Request came from Workflow ABC"}

    ....on the other end

     
    Try
    {

    $MyRequestSource = $Request.GetInControl("MyARControl")

    If ($MyRequestSource.contains("Workflow ABC") -eq $false){return}

    }
    Catch
    {}