cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Saving an Attachment to Sharepoint list using Patch() but "EditForm.Updates" Causes Error(?)

Hello, I have checked several forum posts that discuss how to save attachments using a Form to a Sharepoint list however I encounter an error whenever I try to test a Patch(). 

 

The following is the current code of my patch:

 

Patch(
    PFC_Transactions,
    Defaults(PFC_Transactions),
    {Title: "Test-Title"},
    Form7.Updates
);

 

PowerApps does not notify of any errors and accepts the above however, once I try to test this Patch() function, the following error message prompts:

 

Title: Field 'Title' is required.

 

The Sharepoint list will update with the new record however there will be an error in the PowerApp and no attachment is saved in the Attachment column. I tried removing "Form7.Updates" from the code above and the issue will be gone but there is also no attachment in the record. I do not quite understand the error as the code above contains the Title field and is set to a default "Test-Title" string.

 

  1. I set the Type of the "Attachment" column as Picture. I am not sure if this will allow patching of attachments/images. One of my goals is to allow the user to attach an image and save that image as an attachment along with all the data he inputs in the record. Should I change the data type of the column?
  2. I am uncertain of the parameters required for telling the Patch() function to look at the attachment that the user input. PowerApps is saying that the following is invalid:

 

...{ Title: "Test-Title"
   , Attachment:DataCardValue10.Attachments}....​

 

DataCardValue10 is where the Attach is located within the EditForm's DataCard.

  • I am not sure if this will also help but I made it so the user goes to another screen to click on the attach button then goes back to the previous screen after performing attach. This is because the attachment will be patched to the Sharepoint list along with the other data he inputs in the initial screen. Could it be because the EditForm is in a different screen that the error happens or the attachment is not pushed to the Sharepoint list?

 

I am hoping PowerApps gurus like @v-xida-msft and @v-monli-msft can help 🙂

If any more details are needed to diagnose this issue, please let me know so I can provide them.

Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Saving an Attachment to Sharepoint list using Patch() but "EditForm.Updates" Causes Error(?)

I have resolved the issue by not specifying "Title" to be updated in the patch and simply implementing EditForm.Updates after all the data input in the patch. No need to make an "Attachment" column in Sharepoint as any attachment included in the Form will be tagged as attachment in Sharepoint.

View solution in original post

1 REPLY 1
Highlighted
Frequent Visitor

Re: Saving an Attachment to Sharepoint list using Patch() but "EditForm.Updates" Causes Error(?)

I have resolved the issue by not specifying "Title" to be updated in the patch and simply implementing EditForm.Updates after all the data input in the patch. No need to make an "Attachment" column in Sharepoint as any attachment included in the Form will be tagged as attachment in Sharepoint.

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,916)