Call flows from a model driven app

Wouldn’t it be great if you could call flows from a model driven app? Well you can , but it is not without its difficulties.

Some background

It is easy to start flows from a Canvas app and actually Model driven apps aren’t much harder.

In my case I wanted to create a quote for an opportunity and the document generation told available just weren’t good enough. I wanted my quotes to look better. There are plenty of other processes that I could imagine I would want to start a flow from a model driven app for. But this is quite a nice example flow.

This Send quote flow will send me an email with all of the quote details coming from my opportunity, related account and order lines.

Quite quickly I created a flow that started with the When a record is selected.

Call flows from a model driven app Microsoft Office 365 image 6

Start flows from a model driven app

And then the Send quote options appeared right there with my opportunity in my model driven app.

Call flows from a model driven app

I managed to run the flows and I got this great success message.

Call flows from a model driven app Microsoft Office 365 image 7

Then I started to make some changes to my flow and suddenly things went wrong.

Call flows from a model driven app Microsoft Office 365 somethign went wrong. Please refresh the page or try agains after some time.

And as a scrolled down that message and clicked on the show more details message there is a message that related to the trigger being incorrect.

Call flows from a model driven app Microsoft Office 365 The input body for trigger manual

Time:
Server/Client Correlation ID: 2733bc97-c17b-4751-9b18-e07da64b140e
x-ms-client-request-id (Client->Backend Request Header): 1947f358-8355-453c-a8f4-d730-e74bb6f8
Error: The input body for trigger ‘manual’ of type ‘Request’ did not match its schema definition. Error details: ‘Required properties are missing from object: value.’.

Whatever that is all about, it is not nice!

So I deleted the trigger and then re-added the trigger and fixed all the references to properties that came from my trigger and I managed to start my flow from my Model driven app once again.

Sometimes I can edit the flow 10 times without any problems and sometimes I have to re-update the trigger after every update. This seems to be a bit of an annoying bug. If you happen to find the same issue and you have a better workaround then please leave a comment below.

Model Driven Business Process Flows

In addition to the above method you can also create a flow that runs from the business process flow. All you need to do is add a flow step to your Business Process Flow and you can run your flow from there.

Call flows from a model driven app Microsoft Office 365 image 29

But the details on how to do flows from a model driven app in a Process Flow will be another post for another day.

7 thoughts on “Call flows from a model driven app

  1. Hi Pieter,

    At first I also thought this is a bug, but I have found out that whenever I reference a form field in my flow, the shceme of the trigger action changes this field to “required” (you can verify it by “peeking code” in the trigger action), even if this field is not required in the CDS entity. And if I don’t supply a value for this field in runtime, I get this error.

    The solution I have found is not to reference the fields from the triggerbody action in my flow, but instead, add a “get item” action as the first action in the flow (right after the trigger), and get the item with the same ID as the triggered item. Then, I reference whatever fields I need from the “get item” action, yet the trigger action scheme do not mark any field as required, and the error disappears.

  2. Hi Pieter,

    At first I also thought this is a bug, but I have found out that whenever I reference a form field in my flow, the shceme of the trigger action changes this field to “required” (you can verify it by “peeking code” in the trigger action), even if this field is not required in the CDS entity. And if I don’t supply a value for this field in runtime, I get this error.

    The solution I have found is not to reference the fields from the triggerbody action in my flow, but instead, add a “get item” action as the first action in the flow (right after the trigger), and get the item with the same ID as the triggered item. Then, I reference whatever fields I need from the “get item” action, yet the trigger action scheme do not mark any field as required, and the error disappears.

  3. Hi, i also experienced that, it is quite fragile. Also when you deploy a solution including such flow, to an other environment, it will break… I had to redo the flow as a solution

    An other question : we have per user app plan licence, and flow isnt apparently included, we needed to buy separated flow or M365 licence. Did you experience that ?

    Thank you?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: