Trigger your Flow on Approval Request to send the custom actionable message

Posted by

This is part 3 of the blog post series ‘Take Full Control over Your Flow Approvals‘ and in this part we’re going to create our own Flow to send the custom actionable message. The idea is to hook into the data of Approvals that is stored in the CDS for Apps and is created by the standard Approval actions in your environment(s). In the previous blog post I described the way we can create our own actionable messages for Approvals. We just need a Flow to send these, so let’s start with that. But first I need an Approval action.

I’ve created a Flow for the approval of a Credit Limit for an Account. Enable notifications is set to ‘No’.

Now let’s see what data is created once the Flow is run. The following Approval record is created and updated by the system.

And the next Approval Request record is created that is assigned to the approver (as Owner).

So our own Flow can/will be triggered when a Approval Request record is created, to send the custom actionable message to the approver(s).

We get the related Approval record and the details of the Requestor and Approver. The URL of the receiving Flow is set as value of the variable Flow URL. In the Compose action we add the HTML- and JSON code for the actionable message. The last action is to Send an email to the Approver and add the output of the Compose action into the Body of the email, and set ‘Is HTML’ to Yes.

Now if we start another Credit limit approval, the custom actionable message will be send to the approver(s).

This is the result.

3 comments

  1. Hi,
    Great series of posts about advanced customization of the Flow Approval.
    I was looking in a way to change approvers in already ongoing approval but there are no Approval Request records in the CDS. Has that changed since the time of the post? Should those records be created by the same action as the Approval record? Maybe some additional conditions must be met?

    Kind regards,
    Bartosz Domżalski

    1. Hi Bartosz,
      Are you sure that the approval flow and the CDS you’re looking at are in the same environment?
      Do you have the system administrator role in the environment(s) so you should see all records? No filters in the view?
      Did you create a model-driven app with the Approval entities to surface the data of the approvals?
      I’ve check the approval requests in our default environment and they are there so it didn’t change so it seems.
      For every approver (listed in the ‘Assigned to’ field) there is a approval request that is generated in the same Start Approval action.

      BTW: there’s an interesting article about a custom connector definition for Approvals that might simplify things.

  2. I was looking into the same environment but I’ve wrongly assumed that if I see Approval entities I will also see Approval Request ones. It was a matter of access rights…

Leave a Reply

Your email address will not be published.