I have a PowerApps App consisiting of 4 forms connecting to SharePoint list. There are a number of fields that are required on each form.
In my current (Add/Update) patch it is working great with the exception of my Attachments ( i dont know syntax). I've seen responses here that say that attachments do not work with patch and you have to use SubmitForm(). Based on that, I put the attachment prompt on it's own form however, the "Next Screen" button executes a SubmitForm() for this form I get the error that other fields (that have been entered) are required. I'm assuming because they have not yet been saved to the record in SharePoint and this individual SubmitForm() is attempting to save just the attachments.
Sooooo.... it would be realy nice if I could just add the syntax for saving these attachments within my already working Patch (add/update)
Another developer was excited that he found that he could put frmName.Updates in the Patch command. I tried that too. he stated "I converted to this: GAForm.Updates;frmEnvironment.Updates "
Didn't work for me.
Does anyone know the syntax for Patching the attachment control data?
I have the same issue I want to submit particular detail in data verse table and attachments in SharePoint\One Drive with unique ID to identify.
Did you achieve that?
Aha! I figured it out how to patch attachments from an item in one list to an item in a DIFFERENT list without using flow. If you need to patch attachments from an item in one SharePoint list to an item in a totally different SharePoint list, you must first remove the Attachments.Id parameter from the collection!
I used the following code:
ClearCollect(colAttachments,AddColumns(DropColumns(colAttachments,"Id"),"Id",""));
ResetForm(AttachmentsForm);
Patch(SharePointList,LookUp(SharePointList,ID=ThisItem.ID),AttachmentsForm.Updates);
this is by far the easiest way I've found to do this using power automate - https://youtu.be/yC0W5am6M3Q
This worked like a charm on one app. On another it is leaving certain fields blank in the SharePoint list. Any thoughts?
Hi there,
I am having the same problem that you were having. I have a number of edit screens and some of them have attachments. So I was trying to use Patch at the separate form to submit all the user input. I realize that only the last attachment is saved into the Sharepoint List and not all the attachments. I see you got the solution and saying you are using ADD. May I ask how you did that?
Thank you
I have what I want - I'm able to save attachments on ADD but not on Edit - I will live with that for now. I need to spend more time reading and less time "attempting". This community has been awesome. I'll give back once I'm worthy 😉
@amoncayo wrote:Patch(source, record, FormName.Updates)
Worked for me!!
Patch(source, record, FormName.Updates)
Worked for me!!
Hi @Anonymous ,
Do you want to patch the the attachments file from the Attachments control within your Edit form to your SP list?
If you want to patch the the attachments file from the Attachments control within your Edit form to your SP list individually using Patch function, I afraid that there is no way to achieve your needs in PowerApps currently.
As an alternative solution, you need to consider your Edit form data as a Whole, and type it within your Patch formula. I have made a test on my side, please take a try with the following workaround:
Add a Button within your Edit screen, set the OnSelect property to following:
Patch('20190325_case13', Defaults('20190325_case13'), EditForm1.Updates)
On your side, you should type:
Patch('YourSPList', Defaults('YourSPList'), EditForm1.Updates)
In addition, if you want to update attachments file of an existing SP List Item, please take a try with the following formula:
Patch('YourSPList', BrowseGallery1.Selected, EditForm1.Updates)
More details about the Patch function, please check the following article for more details:
Actually, you could consider use Patch function to patch data into your SP list instead of SubmitForm function. On your side, please set the OnSelect property of the "Submit" button to following:
If( EditForm1.Mode = FormMode.New, Patch('YourSPList', Defaults('YourSPList'), EditForm1.Updates),
Patch('YourSPList', BrowseGallery1.Selected, EditForm1.Updates) )
Best regards,
Thank you for the response. I didn't know Patch didn't support attachments. My first attempt at PowerApps hasn't
been the best. I can see the value in some areas and in others, not so much.
I thought about saving first. Since I have multiple screens with required fields the issue is the Add has to include all of the required fields or it fails. That was the reason I was using Patch - waited until the last SAVE and Patching all fields. If I try to do a quick SubmitForm() on the form with the attachment before the Patch - errors due to empty required fields.
I will tinker with this a bit more. Worse case, I will default data into all of these fields before ths save, add the record and update the record on SAVE - if they cancel I'll have to delete it.
Also, the link we are both referring to - the poster actually said he was using Patch and that he was including FormName.Updates within his Patch and that solved the problem
I converted to this: GAForm.Updates;frmEnvironment.Updates - as I have multiple forms I can add in the update to them all with ; - I did not know I could use .Updates in Patch to do this
I'll let you know what I end up doing.
Hi @Anonymous ,
Adding attachments with Patch is still not possible.
I think you reference this threat https://powerusers.microsoft.com/t5/General-Discussion/Patch-Attachments/td-p/98121. The person in question solved the issue by creating the record with attachments by submitting the form and after that updating the record with Patch.
This scenario will only work in your case if you only want to add attachments when you create a record. You can still not add attachments on an excisting item using PowerApps. If this is something you need to do, you can consider using Flow for adding the attachments to your items. You can trigger the Flow on an action in your PowerApp.
I have found this blog describing how to add attachments to SharePoint items with Flow. I haven't tried this out myself yet. A comment on the blog: the writer of the blog uses the HTTP connector. I would advise you to use the Send an HTTP Request to SharePoint action that is part of the SharePoint connector instead. I think this action was not available yet when this blog was written. The HTTP connector is a premium connector and getting it to work in the context of SharePoint is a lot more work than using the advised action.
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional