Blog
Displaying Real Time Workflow Error Messages in Power Pages
Microsoft Power Pages is a great platform that allows users to leverage much of their existing skills with Dynamics 365 and the Power Platform to create a portal that can allow more individuals to access their system. While Power Automate may be the go-to method to perform automation, real-time workflows also have some user cases as well. One of these use cases is the ability to present error messages if the workflow fails or gets canceled. However, this isn’t enabled out of the box. So, let’s take a look at how we can get this running!
What is Power Pages?
Microsoft Power Pages is a low-code, secure, and enterprise-grade platform for creating, hosting, and managing modern external-facing business websites. It is part of the Microsoft Power Platform family, which also includes Power Apps, Power Automate, Power BI, and Power Virtual Agents.
Why would you want error messages?
One reason we may want these errors is so we can perform some data validation. While this can be done with some JavaScript. Using a real-time workflow doesn’t require code and allows us to leverage the full capability of traditional workflows. Another reason is to simply explain why the workflow can’t be run for a specific instance.
Using a real-time workflow to mark a message as read:
The ‘Mark as Read’ calls a workflow that changes the status reason to Read. In the basic form metadata, where we create the button to run the workflow, we can create a message that appears if the workflow was successful.
When the workflow runs successfully, we get this message:
However, we can’t determine what it says if it fails. We just get the generic error message.
Fortunately, we do have the ability to replace the generic message with a specific one from the workflow. First, we will want to go to the Portal Management app and create a new Site Setting record. The name should be ‘Site/EnableCustomPluginError’, the website will be your website, and the value should be ‘True’.
That allows us to see error messages from the workflow instead of the generic error message. Now we need to create the error message we want to present.
Here we have a real-time workflow that checks who the message is sent by. If it’s sent by the agent, the message is marked as read. If not, we can cancel the workflow.
The value we set as the Status message is what will appear on the portal.
Now when we try to mark a message we created as read the message we get is much more meaningful.
Interested in learning more about all the features Microsoft Power Platform has to offer? Take a look at our Microsoft Power Platform service page.
We love to implement Microsoft Dynamics 365 and Power Platform solutions here at Beringer. We’ve been working with Microsoft Dynamics since its inception, and we’re always finding innovative ways to implement the latest tools and help automate business processes.
Beringer Technology Group, a leading Microsoft Partner specializing in Microsoft Dynamics 365 and CRM for Distribution also provides expert Managed IT Services, Backup and Disaster Recovery, Cloud Based Computing, Email Security Implementation and Training, Unified Communication Solutions, and Cybersecurity Risk Assessment.