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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApp SharePoint Up...
Power Apps
Unanswered

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!

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

    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 

  • robbo1 Profile Picture
    12 on at

    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.

     

  • Verified answer
    SebS Profile Picture
    4,584 Moderator on at

    @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)

     

  • SebS Profile Picture
    4,584 Moderator on at

    @robbo1 

     

    Try above I edit it 🙂

  • robbo1 Profile Picture
    12 on at

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard