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 Automate / Invalid number of argu...
Power Automate
Suggested Answer

Invalid number of arguments in Power apps when setting inputs to optional

(1) ShareShare
ReportReport
Posted on by 26
In power automate, i have connected a power app using "When Power Apps calls a flow (V2)", and in this action i have 15 inputs. 9 of those are required and 6 are made optional.
 
In my power app button, i have:
downtimecommunicationspmtest.Run(Title_1.Text, Substitute(Beschreibung_1.Text, Char(10), "<br/>"), Applikation_1.Selected.Value, Substitute(Impact_1.Text, Char(10), "<br/>"), Text(DateValue1_1.SelectedDate, "yyyy-mm-dd"), Text(DateValue2_1.SelectedDate, "yyyy-mm-dd"), Text(Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0), "hh:mm"), Text(Time(Value(HourValue2_1.Selected.Value), Value(MinuteValue2_1.Selected.Value), 0), "hh:mm"), Region_1.Text, If(Beschreibung_2.Text="", Blank(), Beschreibung_2.Text), If(Beschreibung_3.Text="", Blank(), Beschreibung_3.Text), If(Beschreibung_4.Text="", Blank(), Beschreibung_4.Text), If(Beschreibung_5.Text="", Blank(), Beschreibung_5.Text), If(Beschreibung_6.Text="", Blank(), Beschreibung_6.Text), If(Beschreibung_7.Text="", Blank(), Beschreibung_7.Text)
); ResetForm(Form1_1); Navigate(Erfolgreich, ScreenTransition.Fade);

however this gives me an error saying "Invalid number or arguments: Received 15, expected 9-10. 

receiving 15 seems to be right as those are the number of inputs but how come, it only expects the required options and not the optional fields as well.
Categories:
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,653 on at
     
     
    Pass Blank() when the control seems to be empty: 
     
    If(Beschreibung_2.Text = "", Blank(), Beschreibung_2.Text)
     
    Here is the simplified one:
    downtimecommunicationspmtest.Run(
        Title_1.Text,
        Substitute(Beschreibung_1.Text, Char(10), "<br/>"),
        Applikation_1.Selected.Value,
        Substitute(Impact_1.Text, Char(10), "<br/>"),
        Text(DateValue1_1.SelectedDate, "yyyy-mm-dd"),
        Text(DateValue2_1.SelectedDate, "yyyy-mm-dd"),
        Text(Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0), "hh:mm"),
        Text(Time(Value(HourValue2_1.Selected.Value), Value(MinuteValue2_1.Selected.Value), 0), "hh:mm"),
        Region_1.Text,
        Coalesce(Beschreibung_2.Text, Blank()),
        Coalesce(Beschreibung_3.Text, Blank()),
        Coalesce(Beschreibung_4.Text, Blank()),
        Coalesce(Beschreibung_5.Text, Blank()),
        Coalesce(Beschreibung_6.Text, Blank()),
        Coalesce(Beschreibung_7.Text, Blank())
    );
    ResetForm(Form1_1);
    Navigate(Erfolgreich, ScreenTransition.Fade);
    
     
    NOTE: Using Coalesce() is a bit cleaner than If(..., Blank(), ...) — it returns the first non‑blank value, so if the text input is empty, it passes Blank() automatically. 
     
    Suggestion: Could you please use "Insert Code Snippet" when you post code block?
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • FL-19021510-0 Profile Picture
    26 on at
    Unfortunately the same issue persists. Its as if making inputs optional just removes it as an argument? 

    If I make the options required, the app works, but fails after I initialize it as I have blank fields. So what does optional even do?
  • Haque Profile Picture
    3,653 on at
     
     
    Let's have check from two sides:
     
    1. In Power Apps, you must still pass all arguments. For optional ones, pass Blank() (or Coalesce(control.Text, Blank())) as we did earlier.
     
    2. In Power Automate, check for nulls before using the parameter. Example:
    if(empty(triggerBody()?['optionalParam']), 'default value', triggerBody()?['optionalParam'])
    
    Let me know if it helps.
  • 11manish Profile Picture
    3,333 on at
    try below :
     
    downtimecommunicationspmtest.Run(
        Title_1.Text, 
        Substitute(Beschreibung_1.Text, Char(10), "<br/>"), 
        Applikation_1.Selected.Value, 
        Substitute(Impact_1.Text, Char(10), "<br/>"), 
        Text(DateValue1_1.SelectedDate, "yyyy-mm-dd"), 
        Text(DateValue2_1.SelectedDate, "yyyy-mm-dd"), 
        Text(Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0), "hh:mm"), 
        Text(Time(Value(HourValue2_1.Selected.Value), Value(MinuteValue2_1.Selected.Value), 0), "hh:mm"), 
        Region_1.Text, 
        {
            Beschreibung_2: If(IsBlank(Beschreibung_2.Text), Blank(), Beschreibung_2.Text),
            Beschreibung_3: If(IsBlank(Beschreibung_3.Text), Blank(), Beschreibung_3.Text),
            Beschreibung_4: If(IsBlank(Beschreibung_4.Text), Blank(), Beschreibung_4.Text),
            Beschreibung_5: If(IsBlank(Beschreibung_5.Text), Blank(), Beschreibung_5.Text),
            Beschreibung_6: If(IsBlank(Beschreibung_6.Text), Blank(), Beschreibung_6.Text),
            Beschreibung_7: If(IsBlank(Beschreibung_7.Text), Blank(), Beschreibung_7.Text)
        }
    );
    ResetForm(Form1_1); 
    Navigate(Erfolgreich, ScreenTransition.Fade);
     
    Better to use JSON for so many parameters
  • FL-19021510-0 Profile Picture
    26 on at
    So i used @11manish's solution in the power App for the button and created compose actions for each optional field and made the input according to @Haque. I no longer get any errors from Power App, however the end product (Viva engage post) returns the optional fields as blank even if text is given.

    I checked the flow history, and all the compose actions do not receive ('""') blank as an input and thus outputs blank. Was using compose actions the right idea or was I supposed to implement your code elsewise @Haque?
  • 11manish Profile Picture
    3,333 on at
     good to know that your issue is resolved. As per my current analysis, compose action is right to use here.
  • FL-19021510-0 Profile Picture
    26 on at
    Would you happen to know why the power apps is giving Blanks as answers to the fields even though text is given? I've checked the variable names and everything and they all seem to match...
  • Haque Profile Picture
    3,653 on at
     
    What do mean by "why the power apps is giving Blanks as answers to the fields even though text is given?" - is this sometihng the Blank you get in flow once passed from PowerApps. Could you please clarify - poissbly with screenshot?
     
    Also, it is helpful for us and community if you please mark (first) question answer verified before coming related or next problem in the same thread. 
     
    Thanks.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard