The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Let me first start of with wishing you all a happy new year. I hope you all had a lovely holiday season. I enjoyed a few days off and spent it with my family. On to the subject at hand, synchronous and On-demand Flow in Model Apps. As most of you know Microsoft prefers us using Power Automate Flow instead of Classic Workflow. However there are still some gaps in functionality between the two.
When developing solutions I follow Microsoft guidelines as much as possible. This ensures that the solution is durable and I create the least technical debt. With that in mind, I now keep away from Classic Workflow and use Flow whenever I can. Last few weeks I tried to fulfill business requirements within these restrictions.
None of the two CDS connectors provide an action to create a synchronous and On-demand Flow. In this post I will focus on the On-demand option in relation to the CDS Current Environment connector. The CDS Current environment connector does not have the option to create end-user On-demand Flows. Specifically the “When a record is selected” trigger is not available. Which really is a shame, because as a consultant I want to create On-demand Flows in the development environment and deploy them to the production environment. I do not want to manually export and import Flows or fix connections after each solution import. So I started to think about the most elegant way to fulfill my requirement and man was I in for a treat!
I almost instantly thought of creating a “When a HTTP request is received” Flow. Then add them as a button to the ribbon using the RibbonWorkBench. This solves my requirement as I can add this to a solution and it acts as an On-demand Flow. While doing some research I opened door number 21 of the MVP advent calender. I couldn’t believe what I saw, it was exactly what I needed! Scott Durow released a new version of his SmartButtons. In this version he added support for “WebHooks” that can be used to trigger HttpRequest Flows!
Let’s start creating a SmartButton! If you want to see this example inside a model app, download the solution here.
To use SmartButtons install the solution provided here. This solution contains scripting that executes the button commands. Keep in mind that every environment needs to have this solution installed. Launch the RibbonWorkBench plugin from the XrmToolBox. Connect to an environment and if everything is configured correctly the option to create SmartButtons appears in the bottom left corner.
Add the Run Webhook button to your Ribbon. Fill in the title, the URL of your webhook (the URL of the Flow we created earlier) and you are good to go! Sometimes it is just that easy!
You are absolutely right. When deploying the solution to the production environment the “When a record is selected” Flow will have a different URL for this environment. Luckily Microsoft is working on a way for environment specific variables. I can create a variable for the “When a record is selected” Flow. In this variable I enter the URL of the trigger specific for that environment.
And Scott not only has the same idea, he already has the code! When environment variables become general available Scott will update his SmartButton solution.
Check out the end result in the video above. I am very pleased with this. We have created an synchronous and on-demand Flow with the Current Environment connector. And it even refreshes the form afterwards. Of course this is scripting that does the magic, however it is synchronous none the less! This can be an improvement compared to the usual On-demand Flows. And it most certainly is for this scenario.
Now I cannot take credit for this. Scott has made this available to the community. So if you enjoy this, go ahead and tell him! Check out his blog for more examples of SmartButtons.
I understand the product team’s hesitations when implementing synchronous Flows as synchronous workflows heavily impacts performance. Of course they do not want to introduce the same functionality with the same pitfalls. However there are a lot of business requirements synchronous workflows solves. Especially for citizens developing model-apps.
The lack of communication on this subject worries me. I am afraid to say this out loud, but I think Microsoft might be considering not implement synchronous Flows. I do not have evidence to support this claim. So let’s continue hoping synchronous Power Automate Flows become available soon, just as they are in Canvas Apps.
The post Synchronous and On-demand Flow inside Model Apps! appeared first on Power Addict Ben.
Business Applications communities