web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Execute SQL stored pro...
Power Apps
Answered

Execute SQL stored procedure to add new record to SQL table

(0) ShareShare
ReportReport
Posted on by 14

Hi,

Similiar questions have been asked before, so I hope this is not violating any rules but I simply cannot get this to work on my own after a long time of researching this forum. 

That said, I'm a totally new to PowerApps. 

 

To the problem:

1. I have a stored procedure as below:

 

 

 

/* Procedure to add new data to KPIs*/
CREATE OR ALTER PROCEDURE dbo.AddNewKPI
(
 @KPIName VARCHAR(200)
 , @KPIDescription VARCHAR(500)
 , @KPIGroup VARCHAR(100)
 , @KPISubGroup VARCHAR(100)
 , @KPIOwner VARCHAR(50)
	, @DateCreated DATE 
)
AS 
BEGIN
	declare @KPI_ID int;

 INSERT INTO dbo.KPI (KPIName, KPIDescription, KPIGroup, KPISubGroup,KPIOwner)
	VALUES (@KPIName, @KPIDescription, @KPIGroup, @KPISubGroup, @KPIOwner);
	set @KPI_ID = scope_identity();

	INSERT INTO dbo.KPIValues(KPI_ID)
	VALUES (@KPI_ID);

	INSERT INTO dbo.KPITarget(KPI_ID)
	VALUES(@KPI_ID)
END

 

 

 

 

2. I have set up a flow with PowerAutomate to execute the stored procedure by clicking a button in powerapps. 

Note: I specified 'Ask in PowerApps' for the dynamic content of each paramter. 

Please see the flow below:

pic4.jpg

 

3. Now, I added the Flow to the button and tried to select all the input values from the cards that specify the parameters used in the stored procedure. The values would be inserted by a given user to create a new KPI as in screenshot below.

However, I cannot get the formula to work without errors. I'm receiving an error 'The function 'Run' has some invalid arguments' when I try to select the value cards as input for the stored procedure. 

How can I select the values inserted by a user to be the values for the parameters in the stored procedure?

pic3.jpg

I'm looking forward to any suggestions!

Thanks a lot!!

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @Pewoy 

    Within each card on your form, there will be a text input control (or in the case of the date created card, a date picker control).

    In the call to your Flow, you should refer to the name of the text input control, rather than the name of the card. So instead of KPIName.Value, you would use the syntax DataCardValue11.Text instead (where DataCardValue11 would be the name of the corresponding text input control).

  • Pewoy Profile Picture
    14 on at

    OMG... well that was a quick fix! Thanks a lot!! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard