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 / Procedure or function ...
Power Apps
Answered

Procedure or function has too many arguments specified

(0) ShareShare
ReportReport
Posted on by 67

I have a SQL function set up to calculate premiums.  I'm trying to calculate the premium as we enter a new record and call the procedure from Powerapps with a Flow.  I keep getting the error Procedure or function fn_XXXX_GetPremiumPowerApps has too many arguments specified.  I have 4 parameters that are flowing into the correct variable.  The function works fine in SQL.  Can't get it to test correctly.  Rebuilt it completely in a new flow and still the same error.

Raw Inputs:

{
    "host": {
        "connectionReferenceName""shared_sql",
        "operationId""ExecuteProcedure_V2"
    },
    "parameters": {
        "server""xxxxxxxx.database.windows.net",
        "database""xxx_Replica",
        "procedure""[dbo].[fn_xxxx_GetPremiumPowerApps]",
        "parameters/CoverageAmt"500000,
        "parameters/CoverageType""I",
        "parameters/IMISID""60142",
        "parameters/PlanCode""xxxx-Nationwide"
    }
}
 
Error
    "body": {
        "message""Procedure or function fn_xxxx_GetPremiumPowerApps has too many arguments specified.\r\nclientRequestId: 42a1dd20-558c-4191-b10d-e9eac6d0b36b",
        "status"400,
        "error": {
            "message""Procedure or function fn_xxxx_GetPremiumPowerApps has too many arguments specified."
        },
        "source""sql-cus.azconn-cus-001.p.azurewebsites.net"
    }
}

This is the SQL function:

 

ALTER FUNCTION [dbo].[fn_XXXX_GetPremiumPowerApps] (@IMISID VARCHAR(10), @PlanCode NVARCHAR(20), @CoverageType VARCHAR(1), @CoverageAmt money) RETURNS money
AS
BEGIN
DECLARE @MyPremium MONEY
SET @MyPremium = 0

BEGIN
SET @MyPremium =
CASE @PlanCode
WHEN 'XXX-Mutual' THEN
CASE @CoverageType
WHEN 'F' THEN (@CoverageAmt*0.000098)
WHEN 'I' THEN (@CoverageAmt*0.000068)
END
WHEN 'XXX-Nationwide' THEN
CASE @CoverageType
WHEN 'F' THEN (@CoverageAmt*0.00005)
WHEN 'I' THEN (@CoverageAmt*0.00007)
END
ELSE 0
END
END

IF (@MyPremium IS NULL) SET @MyPremium = 0
RETURN(@MyPremium)
END

 

 

Can anyone point me in the right direction?

 

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @mrscherry2000 

     

    Can you please try this syntax for the input:

    {
     "host": {
     "connectionReferenceName": "shared_sql",
     "operationId": "ExecuteProcedure_V2"
     },
     "parameters": {
     "server": "your-server-name.database.windows.net",
     "database": "your-database-name",
     "procedure": "[dbo].[fn_XXXX_GetPremiumPowerApps]",
     "parameters": {
     "@IMISID": "your-imis-id-value",
     "@PlanCode": "your-plan-code-value",
     "@CoverageType": "your-coverage-type-value",
     "@CoverageAmt": 1234.56
     }
     }
    }
    
  • mrscherry2000 Profile Picture
    67 on at

    Not sure how I would change those since PowerAutomate automatically pulls the parameters from the SQL  function and they are all already set up with @ in SQL but not here

    mrscherry2000_0-1678990740405.png

     

  • Verified answer
    cha_cha Profile Picture
    4,932 Moderator on at

    Hello @mrscherry2000 

     

    I think the issue here is the Function on your SQL. The thing is on your Flow Action you are calling a Stored Procedure but what you set in SQL was a Function. Function and Stored Procedures are not the same. Kindly please delete that function and create a stored procedure. Roughly the Stored procedure code would be:

     

    CREATE PROCEDURE [dbo].[sp_XXXX_GetPremiumPowerApps]
    @IMISID VARCHAR(10),
    @PlanCode NVARCHAR(20),
    @CoverageType VARCHAR(1),
    @CoverageAmt MONEY,
    @MyPremium MONEY OUTPUT
    AS
    BEGIN
    SET @MyPremium = 0;
    
    BEGIN
     SET @MyPremium =
     CASE @PlanCode
     WHEN 'XXX-Mutual' THEN
     CASE @CoverageType
     WHEN 'F' THEN (@CoverageAmt*0.000098)
     WHEN 'I' THEN (@CoverageAmt*0.000068)
     END
     WHEN 'XXX-Nationwide' THEN
     CASE @CoverageType
     WHEN 'F' THEN (@CoverageAmt*0.00005)
     WHEN 'I' THEN (@CoverageAmt*0.00007)
     END
     ELSE 0
     END
    END
    
    IF (@MyPremium IS NULL) SET @MyPremium = 0;
    
    RETURN;
    END

     

    To test it on your server

    DECLARE @MyPremium MONEY;
    EXEC [dbo].[sp_XXXX_GetPremiumPowerApps] 'IMISID_value', 'PlanCode_value', 'CoverageType_value', CoverageAmt_value, @MyPremium OUTPUT;
    SELECT @MyPremium AS 'MyPremium';
  • mrscherry2000 Profile Picture
    67 on at

    That was it.  I thought we were able to use functions as well.  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard