In my previous Microsoft Flow post, I explained how you could import data submitted via a web form. In this post, I plan to enhance what we’ve already built in Microsoft Flow and include an approvals process.
The basic idea is that when a web form is submitted, Microsoft Flow will send an approval request. If the request is accepted, the data will then post into Dynamics 365 as a Lead. If I reject the request, this will trigger an action to delete the email.
I’ve modified the Visio diagram from my previous blog to show you the process changes.
The process starts the same as before. A user submits a web form and an email is received in a shared mailbox in Office 365, with the data in a JSON format.
You can trigger actions off both the ‘Approve’ and ‘Reject’ responses. In this example, I’ve approved the web form and this then posts the data into Dynamics 365 as a Lead.
Microsoft Flow Logic
The logic is essentially the same as before. We receive an email into a shared mailbox with a specific subject line.
Here, we initialise a variable with the ID of the email. This is so we can use this later in the process.
Next, we start the approval process which is one of the Actions within Microsoft Flow. You can assign an approval to more than one person and you have the option to allow anyone on the list to approve the record or force it to be approved by all users. To help with the user experience, you can include a link to the item for approval, but in this example, I’ve just copied the body of the email into the details section of the approval.
The next steps are dependant on the outcome from the approval. To cater for both possible scenarios, I’ve added a switch condition in my Flow based on the response of the approval.
Where the request is approved, the rest of the Flow kicks in and follows the same path as the previous post. It strips the HTML from the body of the email, parses the JSON content in the body and creates a new Lead record from the data.
If the response is not approved, then I’ve added an action to delete the email and passed in the variable for the MessageID.
Where can you use this?
Approvals are really useful. I’ve often had requests to build in quote or proposal approval processes within Microsoft Dynamics 365 and in the past, this always took more time to build that it should’ve. Here, you can utilise Microsoft Flow to drive the approval process and all you need to do is trigger the approval using the Dynamics 365 connector.
There are some really quick training videos about approvals on the Microsoft Flow website that will help to get you started, but if you’re interested in having some training on Microsoft Flow, Contact Rocket CRM to have a chat about your requirements.