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 III
Super User III

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.

 

View solution in original post

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (109,539)