I would like to call a SQL Server stored procedure called get_customer from my PowerApps flow. How do you do this?
I can see in posts that others have been able to do this but I cannot see the option in PowerApps and the only data source options I have is to access the tables and views and not the stored procedure.
I have a button on screen 1 and on click I want it to call a stored procedure and then display the results in a list on the same form. How can I do this?
Thanks
There is no direct way to call a stored procedure from a canvas application. You will need to integrate power automate to achieve the needs. You can check the step by step implementation here: https://powerusers.microsoft.com/t5/Webinars-and-Video-Gallery/Calling-Stored-Procedures-from-within...
Microsoft Power Automate templateOn a recurring basis, execute a SQL stored procedure. Connect your favorite apps to automate repetitive tasks. Check out a quick video about Microsoft Power Automate. Learn how to make flows, easy up to advanced.
In Power Apps Studio, open the app that you want to update. Click or tap Data sources on the View tab of the ribbon. In the right-hand pane, click or tap Add a data source. Click or tap New connection, click or tap SQL Server, and then click or tap Connect.
In order to connect PowerApps to the on-premises SQL Server, you will need to use what is known as the on-premises data gateway. This enables PowerApps to connect to SharePoint and SQL Server networks that are inside internal company networks. You may want to consult with your database administrator about this.
If I understand correctly:
The method I have been calls the stored procedure through Flow. Here's a general idea of how to construct this flow:
body('Execute_a_SQL_stored_procedure').ResultSets.Table1
The naming in this step may vary depending on your setup.In PowerApps, select your button. You can bind it to the flow you just created:
Action > Flows > select your flow
Collect the results of your flow to a collection.
Here is a more precise blog on the related topic for executing a general query, but it applies to your question: https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/
Here is a video demonstrating the flow and the Response action in multiple contexts: https://www.youtube.com/watch?v=MoifwDFKSTo
Please let me know if this has helped.
Mr. Dang
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With