Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

PowerApp SharePoint Upload Button - Help with formula

(0) ShareShare
ReportReport
Posted on by 12

Hi guys,

 

I'm pretty new to Power Apps (an enthusiastic amateur!) and I'm having a bit of trouble getting a Flow to communicate with my App. More specifically I'm having trouble writing the formula to get it to work!

 

Using a guide made by Matthew Devaney I've managed to get my app working. However, all I'm now trying to do is add a notification to let the user know the flow has run successfully (or not). I now get an error stating 'Invalid Number of Arguments'. Would someone mind having a look and see if you can work out where I'm going wrong? I've probably missed a bracket or a comma somewhere, but I can't see where and I've run out of articles on Google to look at! 😁 

 

If(ForAll(DataCardValue2.Attachments As Document,'UploadtoSP(2)'.Run({contentBytes:Document.Value,name:Document.Name},ActivityName.Text,ddProductType.Selected.Value,ddUnit.Selected.Result,Text(Act_St_DatePckr.SelectedDate,"[$-en-US]yyyy-mm-dd"),Text(Act_End_DatePckr.SelectedDate,"[$-en-US]yyyy-mm-dd"),dd_Country.Selected.Value,ddPJHQ_JOA.Selected.Value,ddSub_Unit.Selected.'Sub-Unit',CB_Ent_Keywords.Selected.Value,CB_Ent_Keywords_1.Selected.Value,CB_Ent_Keywords_2.Selected.Value).success ="True",Notify("Uploaded successfully.",NotificationType.Success,10000),Notify("Upload failed.",NotificationType.Error,10000)));
 Reset(DataCardValue2);
 Reset(ddProductType);
 Reset(ddUnit);
 Reset(ddSub_Unit);
 Reset(ddPJHQ_JOA);
 Reset(ActivityName);
 Reset(Act_St_DatePckr);
 Reset(Act_End_DatePckr);
 Reset(dd_Country);
 Reset(CB_Ent_Keywords);
 Reset(CB_Ent_Keywords_1);
 Reset(CB_Ent_Keywords_2);

 Flow_1.pngFlow_2.png

Many thanks in advance!

  • robbo1 Profile Picture
    12 on at
    Re: PowerApp SharePoint Upload Button - Help with formula

    @SebS you are my hero - that worked! Thank you very much for your help! 😁👍

  • SebS Profile Picture
    4,146 Super User 2025 Season 1 on at
    Re: PowerApp SharePoint Upload Button - Help with formula

    @robbo1 

     

    Try above I edit it 🙂

  • Verified answer
    SebS Profile Picture
    4,146 Super User 2025 Season 1 on at
    Re: PowerApp SharePoint Upload Button - Help with formula

    @robbo1 

     

    I'm a donkey 😛

     

    You actually need to Wrap it 🙂

     

     

    If(
     'Power Automate Flow to Run'.Run().success = "True",
     Notify(
     "Flow has run successfully.",
     NotificationType.Success,
     2000
     ),
     Notify(
     "Flow run has failed.",
     NotificationType.Error,
     5000
     )
    );

     

     

     

     

     

     

     

     

    ForAll(
     DataCardValue2.Attachments As Document,
    IF(
     'UploadtoSP(2)'.Run(
     {
     contentBytes: Document.Value,
     name: Document.Name
     },
     ActivityName.Text,
     ddProductType.Selected.Value,
     ddUnit.Selected.Result,
     Text(
    	 Act_St_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     Text(
     Act_End_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     dd_Country.Selected.Value,
    	 ddPJHQ_JOA.Selected.Value,
     ddSub_Unit.Selected.'Sub-Unit',
     CB_Ent_Keywords.Selected.Value,
     CB_Ent_Keywords_1.Selected.Value,
     CB_Ent_Keywords_2.Selected.Value
     ).success = "True",Notify(
     "Flow has run successfully.",
     NotificationType.Success,
     2000
     ),
     Notify(
     "Flow run has failed.",
     NotificationType.Error,
     5000
     )
     );
     Reset(DataCardValue2);
     Reset(ddProductType);
     Reset(ddUnit);
     Reset(ddSub_Unit);
     Reset(ddPJHQ_JOA);
     Reset(ActivityName);
     Reset(Act_St_DatePckr);
     Reset(Act_End_DatePckr);
     Reset(dd_Country);
     Reset(CB_Ent_Keywords);
     Reset(CB_Ent_Keywords_1);
     Reset(CB_Ent_Keywords_2);

     

     

     

     

    Also rather write so many Reset create a variable at end of the code like below

     

     

     

    Set(varReset,true);
    Set(varReset,false)

     

     

     

    and now to each control property Reset add only varReset that will reduce the code

     

     

    ForAll(
     DataCardValue2.Attachments As Document,
    IF(
     'UploadtoSP(2)'.Run(
     {
     contentBytes: Document.Value,
     name: Document.Name
     },
     ActivityName.Text,
     ddProductType.Selected.Value,
     ddUnit.Selected.Result,
     Text(
    	 Act_St_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     Text(
     Act_End_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     dd_Country.Selected.Value,
    	 ddPJHQ_JOA.Selected.Value,
     ddSub_Unit.Selected.'Sub-Unit',
     CB_Ent_Keywords.Selected.Value,
     CB_Ent_Keywords_1.Selected.Value,
     CB_Ent_Keywords_2.Selected.Value
     ).success = "True",Notify(
     "Flow has run successfully.",
     NotificationType.Success,
     2000
     ),
     Notify(
     "Flow run has failed.",
     NotificationType.Error,
     5000
     )
     );
    Set(varReset,true);
    Set(varReset,false)

     

  • robbo1 Profile Picture
    12 on at
    Re: PowerApp SharePoint Upload Button - Help with formula

    Hi @SebS, thanks for replying! Apologies, that was a result of my clumsy attempt to fix it! Here is a neater version of the formula which is working - 

     

    ForAll(
     DataCardValue2.Attachments As Document,
     'UploadtoSP(2)'.Run(
     {
     contentBytes: Document.Value,
     name: Document.Name
     },
     ActivityName.Text,
     ddProductType.Selected.Value,
     ddUnit.Selected.Result,
     Text(
    	 Act_St_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     Text(
     Act_End_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"
     ),
     dd_Country.Selected.Value,
    	 ddPJHQ_JOA.Selected.Value,
     ddSub_Unit.Selected.'Sub-Unit',
     CB_Ent_Keywords.Selected.Value,
     CB_Ent_Keywords_1.Selected.Value,
     CB_Ent_Keywords_2.Selected.Value
     )
     );
     Reset(DataCardValue2);
     Reset(ddProductType);
     Reset(ddUnit);
     Reset(ddSub_Unit);
     Reset(ddPJHQ_JOA);
     Reset(ActivityName);
     Reset(Act_St_DatePckr);
     Reset(Act_End_DatePckr);
     Reset(dd_Country);
     Reset(CB_Ent_Keywords);
     Reset(CB_Ent_Keywords_1);
     Reset(CB_Ent_Keywords_2);

     

     I guess my question is really - How do I Insert the IF statement for the notification without breaking it! 🤣

     

    Your suggestion did not resolve the problem unfortunately.

     

  • SebS Profile Picture
    4,146 Super User 2025 Season 1 on at
    Re: PowerApp SharePoint Upload Button - Help with formula

    Hi @robbo1 

     

    It's looking like Your ")" are all over the place

     

    If(ForAll(DataCardValue2.Attachments As Document,
    
    'UploadtoSP(2)'.Run(
     {contentBytes:Document.Value,name:Document.Name},
     ActivityName.Text,
     ddProductType.Selected.Value,
     ddUnit.Selected.Result,
     Text(Act_St_DatePckr.SelectedDate,
     "[$-en-US]yyyy-mm-dd"),
     Text(Act_End_DatePckr.SelectedDate,"[$-en-US]yyyy-mm-dd"),
     dd_Country.Selected.Value,
     ddPJHQ_JOA.Selected.Value,
     ddSub_Unit.Selected.'Sub-Unit',
     CB_Ent_Keywords.Selected.Value,
     CB_Ent_Keywords_1.Selected.Value,
     CB_Ent_Keywords_2.Selected.Value.success ="True")),
     Notify("Uploaded successfully.",NotificationType.Success,10000),
     Notify("Upload failed.",NotificationType.Error,10000)
     );

     

    try this code hope it sort some of the errors 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard