Reassign Flow Approval Request from the actionable message

Posted by

This is part 4 of the blog post series ‘Take Full Control of Your Flow Approvals‘ and in this part we’re going to implement the reassignment of Approval Request from the custom actionable message and process this is the receiving Flow to update the data in the CDS for Apps.

So what happens when a Flow Approval Request is reassigned to someone else?
Let’s reassign an Approval Request from the Approval portal in Flow.

Reassign an Approval Request from the Approvals portal in Flow

The Approval Request card disappears from the Received tab and is moved to the Sent tab.

Now let’s take a look at the data in the CDS for Apps.

The original Approval Request record is set to Read-only, based on the Status ‘Inactive’ with Status Reason ‘Reassigned’. And a new Approval Request record is created and assigned to the new approver (as Owner) and linked to the original record by its Record Id in the field ‘Reassigned From Index’.
We’re able to recreate these events from our receiving Flow when it’s called from the actionable message.
I’ve added a Reassign action in the actionable message with the following JSON:

{
            "type": "Action.ShowCard",
            "id": "reassign",
            "title": "Reassign",
            "card": {
                "type": "AdaptiveCard",
                "body": [
                    {
                        "type": "Input.ChoiceSet",
      "id": "newApprover",
      "style": "compact",
      "isMultiSelect": false,
      "value": "alans@CRM123456.OnMicrosoft.com",
      "choices": [
        {
          "title": "Alan Steiner",
          "value": "alans@CRM123456.OnMicrosoft.com"
        },
        {
          "title": "William Contoso",
          "value": "williamc@CRM123456.OnMicrosoft.com"
        },
        {
          "title": "Jeff Hay",
          "value": "jeffh@CRM123456.OnMicrosoft.com"
        }
      ]
                    }
                ],
                "actions": [
                     {
                      "type": "Action.Http",
                      "title": "Submit",
                      "method": "POST",
                      "url": "@{variables('Flow URL')}",
                      "headers": [
                        {
                          "name": "Authorization",
                          "value": ""
                        }
                      ],
                      "body": "{'requestId':'@{triggerBody()?['msdyn_flow_approvalrequestid']}','response':'Reassign','reason':'{{newApprover.value}}','userName':'@{body('Get_Approver_record')?['domainname']}'}"
                    }

In the body of the Action.Http I’ve included the Approval Request Id, ‘Reassign’ as Response and the User Name of the new approver as ‘Reason’. This will be used in this part of the receiving Flow:

In the actionable message the new approver can be selected to reassign the Approval Request with Submit.

So in case of the Response is ‘Reassign’, we get the details of the new approver (based on its User Name) and the original Approver Request record.

Then we create a new Approval Request record based on the original one and assign it to the new approver through the fields ‘Owning User Index’ and ‘Owner’.

Next step is to update the original Approval Request record and set the Status to ‘Inactive’ with Status Reason ‘Reassigned’.

The last action is to give a response to the actionable message and update it with a confirmation message.

So to test it, we reassign the Approval Request from the actionable message.

After submitting the actionable message it gets updated with the confirmation.

And if we take a look at the Approval portal, the Approval Request card has moved to the Sent tab.

4 comments

  1. Hello @stefan .

    I have two questions around the ask . How do you check the audit history . I have tried creating the custom app and then i added approvals , approvals request and responses but I cannot see auditing . How can i check the same?

Leave a Reply

Your email address will not be published. Required fields are marked *