This blog article will be discussing how you can trigger power automate flow from the power apps portal without navigating entity forms in the portal. As we you may know, that creating and updating data from an entity or web form can trigger flows because now portals can now be provisioned on the Common Data Service Database. Today, I will show you how to update CDS data by triggering power automate flow from a portal web page without submitting or navigating away from the page.
I have created an editable grid on the power apps portal web page where users can update CDS data. They don’t need to open a web or entity form for each record to update them one by one. I took a simple example here. I created a table (Entity) named CLASS in CDS and add a few columns to it.
The first step is to retrieve the class records into the power apps portal web page where portal users can update it. Keeping it simple, we will be updating class descriptions in series from a portal web page without needing to submit a form. It is simple but hopefully will help in understanding the process.
I used Liquid FetchXML tags to retrieve records on the portal web page. You can use FetchXML builder to compose these statements.
Editable Grid in Power Apps Portal web page:
I created a custom web template to retrieve and display class records on the list on a web page. I used the accordion-style to show the records name and hide the description grid on the web page as it could be lengthy.
The result looks like the below image on the portal web page.
Create Automated Cloud Flow:
The next step is to pass user edits to update the record in Common Data Service. So, we will use Power Automate Flow to update the corresponding record in CDS. We can call FLOW from the power app portal by using the HTTP Request trigger.
This HTTP request accepts data in a JSON string. So, we will pass the JSON string to configure it. We can define our sample JSON string in the custom web template.
This sample string will produce an actual JSON string. You can use this sample JSON string into the HTTP request body and click the “Generate from Sample” button to get the actual JSON string.
When you click the Done button, it will produce a JSON schema for you. Our next step is to update the CDS record by using data collected from the HTTP request trigger. You can use Common Data Service (CDS) current Update connector to update class record in CDS.
We can get “course Id” and “course description” from the HTTP request trigger and set it to update connector to update class data in CDS.
When you save the flow, it will generate an HTTP POST URL that can be used in the JS function to trigger the flow when an update occurs to record on the portal page.
You can test the power automate flow by using POSTMAN to ensure that the JSON will update CDS records.
You can navigate to a portal page where a list of records is displayed and update the class description grid of any record to test the function.
This blog covers how the power automate flow can be used in the power apps portal. You can trigger flows to perform tasks beyond creating and updating the data. Power automate flows can be used to trigger a classic workflow in the power apps portal. You can create a custom web template or use existing templates to code JS function with liquid. If you have any questions, please reach out to us via the contact us page!