No-Code solutions are here to stay, you just have to see the amount of content, use cases, articles, videos and events dedicated, for example, to the Microsoft Power Platform. In my specific case, I do not think that this platform has come to replace all the customizations that we do through X++, although they can help us solve certain problems without the need to generate code, in a faster, cheaper way and easier to maintain.
Let’s put a use case for Finance and Operations: We need to notify a user or group of users when customers are modified and are blocked/unblocked for billing, payments, all… (Update the Blocked field of the CustTable).
As a programmer, the first thing I think is: Ok, there is no Business Event that is triggered when a client is modified, so, I will create my own custom event, which gives me the information I need and is executed when I need it, right? But… wait! If we have an alert framework that works perfectly and a business event that is triggered when one of these alerts occurs, why not take advantage of it? It is clear that the alert that is launched may not have all the information we need, but playing a little with Power Automate we can get it in a few minutes, let’s get to it ;).
The first thing, obviously, is to configure the alert rule. We will create a new one that will be executed when the Blocked field of the CustTable table is edited. It is important to check the Send externally check to yes.
Once we have the alert configured, we create an automated flow of Power Automate using the When a business event occurs trigger from Dynamics 365 F&O.
Important, if we leave the Flow trigger as it is right now, it will be executed for each of the alerts configured in the system. To avoid this and focus only on the alerts that interest us, we can configure a series of filters, and the flow will only be executed when the alert triggered meets the filter conditions.
Once we save the flow, we can check in the Dynamics F&O event catalog that the BusinessEventsAlertEvent business event has been activated against a Power Automate endpoint.
The next thing we will do is create a series of Compose-type steps to mount an Adaptive Card that we will post in Teams to notify the user of the change that has occurred in one of the system’s clients. This message will consist of the customer’s account and name, as well as the new value of the Blocked field.
If we take a look at the JSON that generates the alerts event, we see that in the KeyValue1 and KeyValue2 fields we receive both the client code and its name, but there is no field in which we receive the value of the Blocked field. Is that a problem? Not at all, since Power Automate has a series of connectors that allow us to obtain specific records and the alert business event provides us with the necessary data to search for the client (DataAreaId and CustAccount). Therefore, we are going to get the customer record that has been modified.
Now, we have all the fields of the CustCustomerV3Entity entity, so we are able to assemble the message and the structure of the Adaptive Card and publish it in Teams through the specific connector that will be in charge of sending a message to the specific user.
After these steps, we only have to save the flow and test it, so we go to a customer, modify the value of the Blocked field and wait for the magic to happen.
As you can see, a new message has been published in Teams through the Flow bot indicating that the value of the Blocked field has been modified for a specific customer. In addition, a button appears, and if we click on it, it will take us to the customers form, filtering directly by the customer that we have modified, all this thanks to the Link field that is published in the alerts business event.
To finish the article, I leave you with a video in which we see the operation of what was explained above and I tell you some tricks to take into account to achieve that the result is as expected and that everything works correctly. I hope you like it 🙂 (As usual, the video is in Spanish)
See you soon!