cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Level: Powered On

How to put a attachmentsin SP list with Patch

Hello everyone, I am trying to patch a attachments to my sharepoint list using a Patch funcion on save button

6 REPLIES 6
Dual Super User
Dual Super User

Re: How to put a attachmentsin SP list with Patch

Hey @Gorilla_8 

 

Attachment feature is only available in the Edit Forms, please follow the below steps to configure this.

1) Add an edit form and select the datasource that you are trying to patch.
2) Remove all the fields and just keep the Attachment datacard.
3) On the "OnVisible" property of the screen, use the expression: NewForm(Form1)
4) Now, the attachments can be patched using Form1.Updates as
Patch(DataSourceName, Defaults(DataSourceName),{},Form1.Updates)

You can pass these attachments after passing all the fields inside the curly brackets.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Gorilla_8
Level: Powered On

Re: How to put a attachmentsin SP list with Patch

Like this?

 

i did not get this number 4 in your list

Dual Super User
Dual Super User

Re: How to put a attachmentsin SP list with Patch

Hey @Gorilla_8 

 

The NewForm(Form1) needs to be placed on the "OnVisible" property of the screen. Please remove the piece of code from Visible property of the form control.

The 4th point need to be updated in the Patch function on the save button. You just need to add form1.Updates to the existing formula. The expression provided was just a sample one.

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Gorilla_8
Level: Powered On

Re: How to put a attachmentsin SP list with Patch

Like this?

Community Support Team
Community Support Team

Re: How to put a attachmentsin SP list with Patch

Hi @Gorilla_8 ,

For now, you could only use form to update attachments of sharepoint list in sharepoint.

What's more, you could only use SubmitForm function to update your attachments, not supported using patch function to update attachments.

I notice that you use formula like this: Patch(...,ThisItem,....)

So do you want to edit an existing record?

If so, you just need to use patch to update other fields and then use submitform function to update attachments.

 

I've made a similar test for your reference:

insert a form, set its data source to the table that you want to update, only choose attchments field.

set the form's Item: ThisItem

set the form's DefaultMode: FormMode.Edit

11142.PNG

 

set the submit button's OnSelect:

Patch(...;ThisItem;{.....});;//update other fields;

SubmitForm(Form1)//update attchments

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dual Super User
Dual Super User

Re: How to put a attachmentsin SP list with Patch

Hey @Gorilla_8 

 

The error can be resolved by removing the extra small bracket after "Form1.Updates". There should be only one bracket to close the patch statement.

I have tested this myself and attachments can directly be patched to the CDS entity without using SubmitForm().

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,926)