Using Adaptive Cards as an Alternative to Approvals in Power Automate

While recently perusing the Power Apps and Automate licensing FAQ I discovered that approvals are a premium feature in Power Automate.

After some time gathering myself after reading this knockout piece of information, I thought best to follow up with Microsoft’s Power Automate team for some clarity.

If responding to Approvals are premium (but not creating them) then what about other actions that involve interacting with a flow, such as adaptive cards that wait for a response?

So there you go: As a seeded license holder you can violate Microsoft’s licensing terms and put your employer on the wrong side of the law by creating a flow that uses approvals and send them to users that don’t have stand-alone licenses!

Anyway, it’s good to see adaptive cards can be used instead. Although it’s not clear whether the person who actually clicks on the adaptive card still needs to be licensed, unlike Approvals, these adaptive card actions are available in Logic Apps, where billing is consumption based and no such licensing constraints exist.

Use the action called “Post an Adaptive Card to a Teams channel and wait for a response”. In this case the team only has members who are authorised to approve documents. You therefore don’t need to hard-code names into the flow. If you’re a member of the group you can participate in the approval process. This is like the “First to respond” option in the native approvals.

You can design your adaptive cards in https://adaptivecards.io/designer/ Here is my code for the card I’ve used here

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "type": "TextBlock",
            "text": "Document Approval Required",
            "wrap": true,
            "fontType": "Default",
            "size": "Large",
            "weight": "Bolder",
            "color": "Accent"
        },
        {
            "type": "TextBlock",
            "text": "@{triggerOutputs()['headers']['x-ms-user-name-encoded']} has requested approval for the following document. Click the button below to view and then reject or approve",
            "wrap": true
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.OpenUrl",
                    "title": "@{triggerBody()?['entity']?['fileName']}",
                    "url": "@{triggerBody()?['entity']?['itemUrl']}"
                }
            ]
        },
        {
            "type": "Input.ChoiceSet",
            "choices": [
                {
                    "title": "Approve",
                    "value": "Approve"
                },
                {
                    "title": "Reject",
                    "value": "Reject"
                }
            ],
            "placeholder": "Placeholder text",
            "value": "Approve",
            "id": "Choices"
        },
        {
            "type": "Input.Text",
            "placeholder": "Type your comments here",
            "isMultiline": true,
            "maxLength": 255,
            "id": "InputText"
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Submit",
                    "title": "Submit"
                }
            ]
        }
    ]
}

Remember to type a message to show it’s been actioned and set the drop down to Yes:

Now, because the output of the adaptive card is dynamic based on the schema of the card itself, you don’t get nice easy dynamic content.

If you add a compose and then type an expression into the expression editor body(‘My_adaptive_card_action_name’) you will see its output after a test run:

You can then import this into a Parse JSON Action:

Now I can find “Choices” which is the outcome of the Approve/Reject dropdown as dynamic content:

From here on it’s just the same as any other approval workflow.

The difference being you still comply with Microsoft licensing requirements for seeded plans.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s