Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Add attachments from PowerApps to SharePoint using Patch function

(0) ShareShare
ReportReport
Posted on 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 at
    Re: Add attachments from PowerApps to SharePoint using Patch function

    @FLMike 

    I have attached screenshot of the error

  • Michael E. Gernaey Profile Picture
    40,272 Super User 2025 Season 1 on at
    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard