Windows Workflow Foundation (WWF) is the long-serving underpinning of multiple solution components within Dynamics 365 and the Power Platform. With the announcement of Power Fx, it’s clear that Microsoft will consolidate on a single expression language and eventually remove the dependency on WWF.
Let’s review the solution components that use WWF and consider how to develop complex solutions in anticipation of the impact of Power Fx.
Windows Workflow Foundation
Windows Workflow Foundation (WWF) is part of the .net Framework and provides a workflow engine with a graphical designer and activities. Its capabilities are extendable via custom activities built using C# code. SharePoint 2010 and early versions of Dynamics CRM used WWF to provide workflow functionality. WWF workflows are serialised using the XAML format and stored with a
.xaml file extension.
Windows Workflow Foundation is no longer updated by Microsoft (the last stable release was in 2012). It’s not included in later versions of .net (e.g. .net Core, .net 5 or .net 6) and will not be added to future releases. See here for more information: https://blog.inedo.com/dotnet/windows-workflow-foundation
WWF and the Power Platform
As mentioned above, early versions of Dynamics CRM incorporated WWF, and with a couple of exceptions, these components are still available for use. Internally, the following solution components use WWF. One can confirm by unpacking a solution (using the solution packager) and examining the contents.
- Calculated Columns
- Business Rules
- Business Process Flows
- Classic Workflows (real-time and background)
- Custom Workflow Activities (aka CWAs)
- Dialogs (deprecated)
- Task Flows (deprecated)
Based on the announcements at Build 2021, calculated columns will move to Power Fx formulas. On 16 June 2021, a new drop-down appeared in the classic solution explorer when creating a calculated column, so change is happening already!
Power Fx will expand hugely on the limited set of functions provided in the existing calculated column editor.
I’m guessing that the classic WWF calculated columns will continue to exist alongside Power Fx calculated columns. With the constrained editor and functions available to calculated columns, one wonders about the prospect of an automatic conversion to Power Fx formulas.
As per calculated fields, business rules are currently edited using a constrained editor, so automatic conversion to Power Fx may be possible at some point.
Business Process Flows
Business Process Flows were introduced in Dynamics 2013, but now fall within the Power Automate section in Microsoft documentation. Business Process flows can call on-demand workflows and actions. Although the designer for business process flows is similar in look-and-feel to the business rule designer, it’s unclear how Microsoft will transition business process flows away from WWF. Continuing to use business process flows and waiting for future developments appears to be the best approach.
Within the maker portal it’s only possible to edit existing classic workflows. To create new classic workflows one must switch to the outgoing classic solution explorer. At Build 2021 Microsoft also stated the existing maker portals for canvas and model driven apps will be combined into a single maker portal by April 2022.
Microsoft has long recommended replacing classic workflows with cloud flows. Cloud flows and the Dataverse Connector have reached functional parity with background classic workflows. There is unlikely to be a conversion path between the XAML of classic workflows and the JSON format used by cloud flows due to the different technical capabilities. (e.g. calling CWAs).
If it’s not clear already, cloud flows should be used instead of background workflows!
Real-time classic workflows operate within the database transaction. They provide the ability to cancel an operation or allow the user to see the immediate result of a workflow. Some scenarios can be replicated using business rules and calculated columns. For others, there may be no alternative other than a plugin, especially if a CWA or Action is included in the workflow steps.
Classic workflow steps have no “low-code” replacement. In the fullness of time, Power Fx formulas may be applicable. ‘Sequential’ declarative formulas akin to those used within events in a canvas app could be a good fit.
Microsoft state ‘Real-time workflows should be used with care’. Simple workflows provide an easy way for customisers to add functionality (e.g. setting the primary attribute), however once a level of complexity is reached it may be more efficient to use a plugin.
Actions (aka Custom Process Actions) are a means to add a custom ‘message’ to Dataverse. Actions can use workflow steps to invoke custom workflow activities or other actions. Many developers prefer to register a plugin that listens for the message and implements the logic in plugin code rather than using workflow steps. Actions without workflow steps are readily convertible to Custom APIs, see https://markcarrington.dev/custom-action-to-api-converter/
Custom workflows activities
Custom workflow activities are C# assemblies that extend the CodeActivity class that is part of Windows Workflow Foundation. CWAs can access the images using the PreBusinessEvent and PostBusinessEvent entity images.
If pre or post business event images are required, consider using a plugin. Otherwise, since the workflow steps can invoke actions, consider using a plugin connected to a Custom API as a migration path away from custom workflow activities, see https://itmustbecode.com/dataverse-custom-api-enabled-for-workflow/.
Processing XAML files by the solution engine during import is slow. In testing, removing business rules and classic workflows reduced solution import time. In comparison, Power Automate cloud flows install quickly, although there is a delay after the solution import is marked complete while cloud flows are ‘turned on’ in the background.
There is no mention of workflows or CWAs in the MS Learn courses or the syllabus for the PL-400: Microsoft Power Platform Developer exam.
Plugins implement the IPlugin interface which is not part of Windows Workflow Foundation.
Where will Power Fx be surfaced?
- Power Apps Canvas
- Model Driven Command Bar
- Dataverse Calculated Columns
- Business Logic Components (my term for this planned feature) - this item has been pushed out multiple times since first added to the roadmap, and is currently planned for public preview in August 2021.
- End of 2021
- AI Builder
- Business Rules
- Power Automate (Cloud & Desktop)
- Power Virtual Agents
- Power BI (Orchestration)
Source: Build 2021 Power Fx presentation
This is an evolving topic, and I’m sure we’ll find out more in the fullness of time as the roadmap for the Power Platform is revealed. The following is for consideration. You may disagree with the summary below, and if so, I’d love to hear your reasoning.
- By reviewing Microsoft’s actions and statements, we can see there is a clear effort underway to replace Windows Workflow Foundation.
- Except for dialogs and task flows, no official deprecation announcement has been made regarding any component that uses Windows Workflow Foundation - especially workflows.
- The strong recommendation is to use Power Automate cloud flows instead of background classic workflows for new developments and consider switching existing background workflows to cloud flows as the opportunity arises.
- Power Fx will provide an alternative to WWF for calculated columns.
- Power Fx will provide a replacement/alternative to WWF for business rules in the fullness of time.
- It’s unclear how business process flows will migrate away from WWF.
- Continuing to use calculated columns, business rules, and business process flows and monitoring how the platform evolves appears to be the best course of action.
- Consider the complexity and effort required to replace or rework business logic implemented using real-time classic workflows in a new technology. Consider using plugins instead of classic workflows if CWAs are required in workflow steps. Waiting for some future low-code replacement for real-time workflows may be a good strategy in some scenarios.
- Consider alternatives to actions
- Convert actions to Custom APIs if workflow steps are not used. An action using workflow steps may need to be reworked when WWF is finally deprecated.
- For actions with workflow steps that contain CWAs using PreBusinessEntity or PostBusinessEntity images then consider using a plugin.
- For actions with workflow steps that contain CWAs that do not use images consider moving to a Custom API and plugin.