In today’s post I’m going to use the Power Platform and business events to show you how to take the Microsoft Dynamics 365 Finance and Operations Workflow approvals outside MSDyn365FO.
- Power Automate Approval Html
- Power Automate Approval Markdown Table
- Power Automate Approval Markdown Tool
How? Using business events, power automate and adaptive cards to display nice messages in Microsoft Teams.
Because you have to create a ticket in Jira for the change request, wait for approval, have to review the. They really should automate this part of.
If you want to know more about using business events in Dynamics 365 you can check these posts from Juan Antonio Tomás:
- Vinni Dang doesn’t consider herself a software developer, but she is certainly a problem solver. When Dang recognized the manual process used by the Microsoft employees who access 1,300 company.
- Markdown is used to format text in approval requests. This video demonstrates the use of markdown for headings, bold, and italicized text. Format approval emails with markdown - Power Automate.
- Power Automate offers us two ways for sending approval adaptive cards to Teams channels: Create an approval first, send the automatically generated adaptive card to Teams using the Send your own adaptive card as the Flow bot to a channel action, and stop to wait for an approval.
- Business Events: Custom payload part 1, part 2 and part 3
Workflow business events
Workflow business events are not used to replace the standard workflow framework, they actually run along with it, like the alerts business events. For the workflow business events to run, the standard processes must run first, and after the work items are created the work item business events will trigger.
If we create a new Power Automate flow and add a FnO trigger we see can select different workflow categories, depending on what we want to achieve.
In my example we’ll be using the Workflow workitem category. This triggers the flow when a workitem is created.
I will be following this tutorial as a guide, but the approval steps will be done in Teams instead of Dynamics 365.
Power automate flow
How does my flow looks like? It’s something like this:
Don’t panic! It’s really simple, it just has many extra steps to make everything pretty. Let’s see what each step does.
Trigger
This is our trigger, the step that starts everything, which will fire when a workitem for the workflow Approve purchase requisitions is created.
After the trigger fires we need to parse its output using the Parse JSON action. We need to enter a schema so the parsers knows what to expect and which elements the JSON has. We can download a sample of the JSON from the business events workspace:
We can use the content of the downloaded file as a sample in flow.
Execute action
This step will validate that the business event that has triggered the flow is running, has a correct instance id and is waiting for approval.
Then, we will evaluate if it is running, and continue.
Adaptive cards
Now we will create two adaptive cards that will help us display the information in Microsoft Teams in a nice way. What are adaptive cards?
Adaptive Cards are an open card exchange format enabling developers to exchange UI content in a common and consistent way.
Yeah… well, adaptive cards basically are a a way of building an interface to display information in different systems. If you visit its site you’ll see there’s a designer where you can play with them. When you finish creating your adaptive card, you get a JSON that has all of its information. Pushing this JSON to Teams using the connector will display a card with links, images, buttons and whatever you need. Try it!
In this step I’m creating a text. Using the information we receive after parsing the business event trigger´s output. This will show the user what he’s been assigned and why.
In the next step I’m just storing the URL that opens the purchase requisition in Dynamics 365.
And finally I compose the adaptive card’s JSON:
The first Outputs element corresponds to the text I’ll be showing in the card and the second one the URL. This adaptive card has just some text and a View button that opens Dynamics 365.
Why am I taking those extra compose steps? Because sometimes the JSON won’t be generated correctly with all the text put in there. Plus it’s tidier.
In the next step we will post the adaptive card to the user who has the workflow assigned:
In this case the Outputs element is the one from the Compose information adaptive card. How does this card looks like?
We can see the purchase requisition number and why it needs an approval. And we can open the purchase requisitions form inside Dynamics 365 using the View button.
Approval
After showing the information to the user we ask for an action with the adaptive card on the left.
You can see it has an action set with two actions: Approve and Reject.
Otherwise it’s a very simple adaptive card that only show a text that reads “Do you want to approve or reject the above purchase requisition?”.
Next we post this as an adaptive card and wait for an answer:
And this card will look like this:
Just an Approve and Reject button.
And now comes the tricky part. This action is in preview and it’s output isn’t shown on the next step because… I don’t know why, the preview? But it has an easy fix which I learned in this video from Mar Llambí. We just need to add another compose and in its expression we will write outputs(‘Post_and_wait’)?[‘body’]?[‘submitActionId’], where Post_and_wait is the name of the action above.
Then we can evaluate which button has been pressed and approve or reject the workitem:
And done! If we go to the workflow history we will see the approval message in the workitem:
Conclusion
As I’ve said other times and I wanted to show with my PatatApp, we can use the Power Platform with Dynamics 365 for Finance and Operations. It’s getting better every day and offers plenty of solutions that allow us to change the standard FnO’s functionality. And it can be done in just a little time!
Go and try it!
Subscribe!
Receive an email when a new post is publishedTags
CRM 2011, Microsoft Dynamics CRM, Microsoft Dynamics CRM 2011 Workflow - Parallel Wait Branch {Conditions}, MSCRM 2011
Parallel wait conditions provides a powerful way for a particular condition to occur avoiding any custom code.
In a particular scenario, my client wants to follow-up with a lead with the E-mails on random intervals, say after 10-days, then 30-days, then 45-days, then 3-months.
A simple workflow with Timeout process did the trick.
But what about the condition when a reply is received from that lead ? We need to stop the workflow then and there itself.
The Parallel wait branch made the task much easier, one or more conditions can be added parallelly before a step can be taken further.
Power Automate Approval Html
In my case, if a mail is received then i could make the workflow stop with the status of succeed before processing any further or waiting for the Timeout to complete.
Power Automate Approval Markdown Table
Hope this might help someone to write a powerful workflow and explore the rest options of CRM-Workflows !!!
Power Automate Approval Markdown Tool
🙂