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

Community site session details

Session Id : qIUwPyEO1EP4rxl13PNhC3
Power Apps - Building Power Apps
Unanswered

Add attachments from PowerApps to SharePoint using Patch function

Like (0) ShareShare
ReportReport
Posted on 22 Sep 2023 04:47:07 by 559

Hi All,

 

I have a form where there are is an attachment column which needs to attach files from PowerApps to  SharePoint list using Patch function. I am using Patch function for the form because I have two choice fields which is of Multi-select column type. I have two for ne for Edit and New form. The Patch function which I have given is :

If(
IsBlank(DataCardValue1_2.Text) || IsBlank(DataCardValue5_2.SelectedItems) || IsBlank(DataCardValue2_2.Text) || IsBlank(DataCardValue3_2.Text) || IsBlank(DataCardValue4_2.Text) || IsBlank(DataCardValue11_2.Selected) || IsBlank(DataCardValue16_2.SelectedItems) || IsBlank(DataCardValue17_2.SelectedItems) || IsBlank(DataCardValue18_2.Selected) || IsBlank(DataCardValue19_2.Selected) || IsBlank(DataCardValue10_2.Text),
UpdateContext({varblank: true}),
If Error(
Patch(
VictoryStrokes_List,
Defaults(VictoryStrokes_List),
{
'Case Title': DataCardValue1_2.Text,
'Case Study Value Focus': DataCardValue5_2.SelectedItems,
'Competencies involved': DataCardValue17_2.SelectedItems,
'Customer Name': DataCardValue11_2.Selected,
'Business Challenge or Need': DataCardValue2_2.Text,
Solution: DataCardValue3_2.Text,
'Business Benefit': DataCardValue4_2.Text,
'Customer Testimonial': DataCardValue6_2.Text,
'Profit Line': DataCardValue20_2.Selected,
'Contributing Team members': DataCardValue16_2.SelectedItems,
'Primary Engagement work': DataCardValue18_2.Selected,
'Technologies involved': DataCardValue10_2.Text,
'Engagement Start Date': DataCardValue13_2.SelectedDate,
'Engagement End Date': DataCardValue14_2.SelectedDate,
'Company Engagement': DataCardValue15_2.Selected,
'Delivery Model': DataCardValue9_2.Selected,
'Engagement Deal Size': DataCardValue22_2.Selected,
Geo: DataCardValue8_2.Selected,
'Industry Vertical': DataCardValue7_2.Selected,
'Project Delivering Company': DataCardValue19_2.Selected
},
Form1_2.Updates
),
Notify(
"Details needed",
NotificationType.Error,
1000
),
Notify(
"submitted successfully",
NotificationType.Infomation
1000
),
ResetForm(Form1_2);
Notify(
"Case Details submitted successfully",
NotificationType.Information,
1000
) && Navigate('Gallery Details')
)
)

Without giving attachments it is saving fine. but if I give Form1_2.Updates to save attachments it is giving the error notification which I given above.

 

Any help or suggestion on this would be greatly appreciated.

Thanks in advance.

Categories:
  • Sri Profile Picture
    559 on 22 Sep 2023 at 06:23:19
    Re: Add attachments from PowerApps to SharePoint using Patch function

    @FLMike 

    I have attached screenshot of the error

  • Michael E. Gernaey Profile Picture
    45,293 Super User 2025 Season 2 on 22 Sep 2023 at 05:24:46
    Re: Add attachments from PowerApps to SharePoint using Patch function

    Hi,

     

    Happy to help!!

     

    There are a few issues I see. Also, could you 🙂 please use the </> when posting code. It makes it so much easier for me to copy out and fix straight away :-).

     

    These changes will help us identify the issue (including the Error message and extended details)

     

    Bug:

    1. In the code you have the following code

    Notify("submitted successfully", NotificationType.Infomation 1000),
    
    But there is no comma between the Information and 1000

     

    Asks:

    1. Can you please change your Error Notification to actually be this.

    //change this
    Notify(
    "Details needed",
    NotificationType.Error,
    1000
    )
    
    // to
    Trace("Error: " & FirstError.Message);
    

     

    Also, please change your Success to

    // This is where the bug is too, but please change this
    Notify("submitted successfully", NotificationType.Infomation 1000),
    
    // To this
    Trace("Submitted Successfully");

     

    Ok, now please do the following steps. This will help us

    Step 1. Close your App (stop it running)
    Step 2. Click the Stethoscope in the Top Right

    FLMike_0-1695360158277.png

    Step 3. On the bottom click Open Monitor

    FLMike_1-1695360176576.png

     

    Step 4. Once Monitor is running go back and run your app
    Step 5. Cause your issue to happen
    Step 6. Close the app (stop it running)
    Step 7. Go to the Monitor and Filter (top right) based on Error, or key word. Find the error line and look at the information Monitor has for why it failed.

     

    Please go to the Request and Response Tabs.

    Please copy the request details

    Please copy the Response details

    --Please make sure to click the > for header and body to make them expand all the details.

     

    Please (email me) if you dont want to share. OR if that shows you the issue and you fix it, please Mark this suggestion as Resolved 🙂

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete