cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tryingmybest
Regular Visitor

Update SharePoint item from PowerApps Collection

I am attempting to add attachments to my SharePoint list (test New Triage Request Form) to a specific record.  I have two screens which have an Edit Form (Form_1, Form_2). Both attachments appear in my collections (TempAttachmentsCol); however, when I run the following Patch, only the Form_2 attachment appears on the SharePoint.

 

Patch('test New Triage Request Form', LookUp('test New Triage Request Form',ID=TempCol.ID),{
},Form_1.Updates,Form_2.Updates);

 

Is there a better way to update the SharePoint record with the attachments in the Collection? Or am I on the right track?  Thank you

9 REPLIES 9
WarrenBelz
Super User
Super User

Hi @tryingmybest ,

Firstly FormName.Updates requires the attachments to be in an attachment control (not sure what you mean with attachments in the collection.)

I assume you have an attachment control on each  - the problem you have (I did some testing here to confirm this) is that like any field, when Power Apps updates it, the field is overwritten by the current content of the field in the form providing the update.

In this case, Form_2 would contain any existing (written to the list at the time it was opened) attachments and the new items uploaded to it. It knows nothing about anything you have just done on Form_1, so updates the field with those items and subsequently over-writes anything just changed by Form_1 (this is not just the attachments, but any other common field they contain)

It is also not much use refreshing Form_2 after submitting Form_1, as this would clear any updated information on it. Your only solution is to submit Form_1 first, then open Form_2 after this and then change and submit it.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Ramole
Super User
Super User

Hi @tryingmybest 
Check @RezaDorrani  has a video about attachment in collection and send it off to SharePoint an easy way, also he has a sample of the app he demo, you will never get find better than how @RezaDorrani showing, also he has lots of videos that will help succeed in Building PowerApps  meaning NO delegation issue and performance supersonic 👏 for him .
Here is the link of video Power Apps SharePoint List Attachments | Save Camera Pictures, Pen Input & Images 

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
WarrenBelz
Super User
Super User

Hi @tryingmybest ,

Before you spend time exploring @RezaDorrani 's video, it relates to a completely different subject and far more complex process to what you have posted (and actually involves only one Attachment control). You have asked about sequentially Patching two unsaved forms, both with attachment controls. The easiest solution is what I posted - save Form_1 first and then open Form 2.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Ramole
Super User
Super User

@tryingmybest 

If you need patch multiple forms here is a good tutorials  https://youtu.be/9gI9OscTLD0

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
WarrenBelz
Super User
Super User

Hi @tryingmybest ,

The last video only has one of each one attachment control and does not solve your problem. The whole idea of multiple forms is to have different fields on each of them, so when you Patch(Form.Updates), nothing  will overwrite something written earlier. You can however use Patch with individual field references on everything but attachments.

Ramole
Super User
Super User

@tryingmybest 

The best way to test it download the demo app supplied in the demo by PowerApps guru @RezaDorrani  and see it yourself. Rather than confusing information 

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
WarrenBelz
Super User
Super User

@tryingmybest ,

I will not continue this side conversation on your thread other than ask that you tag me if you want some actual code and factual guidance rather than hyperlinks.

tryingmybest
Regular Visitor

I thank you both for the enthusiastic replies. WarrenBelz was very close to the solution. His comments made me relook at the patch. I created a second patch so each form had it's own and it worked.  Also, I have viewed many of RezaDorrani  videos. They have been very helpful. I have also gained a lot of knowledge from Shane Young and Audrie Gordon.  I thank you all for posting these videos. I hope I can continue to come to this Community for answers.

Thanks @tryingmybest ,

Good to see my analysis of your issue was not confusing to you. What you have done is probably what I suggested (to do them separately)

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (1,829)