As you all know Power Automate is really cool! It has got a lot of connectivities. This post aims to focus on Power Automate and also a scenario in which it can be utilized.
Consider a scenario. Payments are managed by another system and no payment / bank details are stored in Dynamics 365 CRM. But still need the capabiltiy to update it occasionally from Dynamics 365 CRM. Power Apps can be very handy in this context. An embedded Power App ( Canvas App) in Model Driven App is used here to capture the details. It triggers a Power Automate ( Flow) from a button. And then Power Automate publishes an Azure Service Bus message to the queue ( Azure Topics are also supported here in complex scenarios). An Azure function listens to Azure Service Bus queue and it gets triggered when a message arrives in the queue. Please note that it could be a console app as well. I chose Azure function for demo purpose. Azure function calls APIs of payment system and the details get updated there.
Obviously there are other ways to do it. This is just one option. Service bus is known for it'd resilience and also it has other features like retry message mechanism etc.These are just some guidelines, feel free to update as per your requirement / scenario.
Here is a small diagram to understand this sample scenario.
There are plenty of posts about Embedded Power Apps which triggers a Power Automate. So I am skipping screen shots for those. Assumption is that there is a bank wizard Canvas App and user access it when bank details need to be updated. On submission a Power Automate gets triggered from the button.
First things first! Let's create a Service Bus and a queue.
Navigate to htts://portal.azure.com/ and choose create new Service Bus option. Here , I chose a basic pricing tier.
Important part of the Service bus is of course it's connection. This is required to establish a connection. It is found in the Shared Access Policy section.
Primary connection string is what we need.
At this stage, assumption is that an Embedded canvas app triggers a flow with 4 Parameter values. Skipping this, as there are plenty of posts about this part.
Next part is the Power Automate. It has mainly 3 steps. PowerApps is the trigger point of this Power Automate. Compose step forms a Json message from the values sent across. Send Message step is for sending a service bus message.
Next part is to have an Azure function to gets triggered as soon as the message arrives in the queue. As mentioned earlier this could be a console app as well.
Queue name is updated as bankwizardq in the function. Next step is to run the function using the run button. When a message arrives in the service bus queue, function gets triggered.
Azure function can call Third party APIs to udpate the details / Udpate DB as per the requirements. These are guidelines only. As per your requirement, things change.