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 Stored Procedu...
Power Apps
Answered

Execute Stored Procedure Error

(0) ShareShare
ReportReport
Posted on by 640

Hello,

 

I have stored the SQL procedure set to run on the Button click property. And in the stored procedure, Except ID column is null. But whenever I try to run the procedure it gives me an error "The Method run has an invalid parameter". 

 

And if I try to run the procedure from the database end it works fine. 

 

Any suggestions? 

 

Thanks,

Omi

Categories:
  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    You can't run a stored procedure using Power Apps.  You can only run it using Power Automate. Its one of the limitations of the SQL connector in Power Apps. Check the "Known Issues and Limitations" here:
    SQL Server - Connectors | Microsoft Docs

  • omi18 Profile Picture
    640 on at

    Hi @Pstork1 ,

     

    Yes, I'm running the flow (Automate) from powerapps. 

     

    Thanks,

    Omi

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    Is the ID parameter one of the required parameters for the stored procedure?  Have you double checked the data types for all the values you are using for parameters?  Can you provide a screenshot of the Execute Stored Procedure V2 action you are using in the flow?

  • omi18 Profile Picture
    640 on at

    I have below screen;

     

    omi18_0-1615222913918.png

    Out of that only ID, is mandatory. And is set up the same way in a stored procedure as well. This procedure only works if I fill in all the values. Otherwise gives me the same error for empty fields. 

     

    Thanks,

    Omi

  • omi18 Profile Picture
    640 on at

    Hi @Pstork1 ,

     

    Below is my Flow for the procedure.  Yes, I did check the datatypes. 

    omi18_0-1615223556438.png

    Thanks,

    Omi

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    SQL stored procedures allow for parameters to be null, but Power Automate doesn't have that concept.  So although the stored procedure doesn't require the parameter the Run command to invoke the flow will require a value for each of the "Ask in PowerApps" prompts you've created.  Its a bit more work, but with this many fields to pass I usually find it easier to pass a JSON object with the values in it rather than individual "Ask in Power Apps" values.

  • omi18 Profile Picture
    640 on at

    Hi @Pstork1 ,

     

    I see, can you share an example/reference related to my scenario? 

     

    It would be great. 

     

    Thanks,

    Omi

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    You mean an example of passing the parameters as a JSON object?

  • omi18 Profile Picture
    640 on at

    Hi @Pstork1 ,

     

    Yes.

  • Verified answer
    Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    I don't have anything quite as extensive as yours, but maybe this will help.  The following is what is on the onSelect to run the flow. It builds a record with all the parameters and then sends it as JSON to the flow.

    UpdateContext(
     {
     params: {
     Customer: Concatenate(
     txtCustomer.Text,
     "%"
     ),
     EndDate: Text(
     dteEndDate.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     MaxValue: 50000,
     MinValue: 40000,
     StartDate: Text(
     dteStartDate.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     )
     }
     }
    );
    ClearCollect(
     returns,
     StoredProcJSON.Run(
     JSON(
     params,
     JSONFormat.IndentFour
     )
     )
    )

    And here is the flow.  I Parse the parameter coming in and use those values in the stored procedure.

    image.png

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard