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

Patching to sharepoint list not working for attachment under my Edit form in powerapps

Hello People,

 

I am completely stuck on how to handle items that have attachments on my sharepoint list.

On my powerapps edit form, i am trying to patch any changes made on the selected record on my browse gallery.

All the other columns are patched well on my sharepoint list with an exception of the attachment column. I have tried every suggestion mentioned on this forum but nothing seems to work. I just don't understand why it has to be so hard patching attachments considering it's a very important control in powerapps.

This is what i have so far on my onSelect property of my submit button on my edit form. My edit form is EditForm1 this is where all my datacards are including the one for attachment. Please help. My client is about to give up on me 😞. Removing the 'Attachments': BrowseGallery2.Selected.Attachments makes no difference.

 

Patch(
    'Message Details',
    Defaults('Message Details'),
    {
        ParentID: BrowseGallery2.Selected.ID,
        'First Reviewer': BrowseGallery2.Selected.'First Reviewer',
        'Type of message': BrowseGallery2.Selected.'Source of message',
        'Source of message': BrowseGallery2.Selected.'Type of message',
         Topic: BrowseGallery2.Selected.Topic,
        'Message Classification': BrowseGallery2.Selected.'Message Classification',
        'Attachments': BrowseGallery2.Selected.Attachments       
    },
    EditForm1.Updates
);

 

All i need is for my edited data including the attachment to be patched as a new record on my sharepoint list. All the other details are patched well when i click on the submit button, except my attachment.

question1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @nduati ,

But you are creating a new record with the Patch. A far easier way is to simply do it on a New Form.

NewForm(YourFormName)

and then simply SubmitForm with the data and the Attachment. Is there a reason you cannot do this?

 

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.

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @nduati ,

Simple answer, but may not be the one you want. You simply cannot Patch attachments. The only way to add or delete attachments is to do it in the attachment control and then SubmitForm.

If you are creating a new record, there is no other way than SubmitForm if you have an attachment. There may be a workaround on Edit, but I have to ask, why not simply submit the new form?

 

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.

Hi @WarrenBelz ,

 

Unfortunately when i just use SubmitForm, it only updates whatever record that was selected on the BrowserGallery. I don't want this selected record to be updated, i want it to maintain it's original state, but now create a new record out of the existing details of the original selected item as well as updates done on the Edit form, that's why i only thought of Patch as the only way to achieve this. I am doing this so as not to lose the different statuses an item can go through. Basically part of my edit form involves assigning a Topic to an item. As you noticed on my Patch code Topic: BrowseGallery2.Selected.Topic. So every time a new Topic is assigned to the original item, i want a new record created with the new Topic as well as all the other details that existed with the original item, including the attachments. Not unless there is another way of using the SubmitForm under the Edit Form to create a new record and not just updating the selected item.

Hi @nduati ,

But you are creating a new record with the Patch. A far easier way is to simply do it on a New Form.

NewForm(YourFormName)

and then simply SubmitForm with the data and the Attachment. Is there a reason you cannot do this?

 

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.

 

Hi @WarrenBelz ,

 

Your line of thought has guided me to the right direction to a solution to my problem. I was approaching it the wrong way and now i have finally managed to use the NewForm(myform) and SubmitForm  to a solve my problem. Thanks for your help.

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,225)