Hello,
I am trying to update my patch function that will allow me to upload an attached file.
I have two forms and each one is different because I was not the original developer.
The first form uses containers and the second form uses datacards.
I have tried to update the below code that will allow me to upload any attachments when the patch function is initiated but the patch complains.
Saw a lot of things online but they all seem to reference an edit form.
Hi Warren,
Yes, good point about the submitting the form and creating a separate new record from the patch. I agree that maybe submitting the form thus adding the attachment(s) to the record and then run the patch using "OnSuccess" property and leveraging the ID from LastSubmit may work. Definately will look at this Monday.
Thanks for your insight!
Hi @golfnutt82 ,
I must admit that is a new one on me (though I have never tried it) - you may have to add another field to the form (you can hide it). .Updates should work on new and Edit, however beware on New it will create a new record separate from the Patch. To be honest the best way would be to submit the Form with the Attachments then run your Patch OnSuccess using the ID from LastSubmit.
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.
MVP (Business Applications) Visit my blog Practical Power Apps
Hi Warren,
I was able to add a form.
Here are the datacard details.
When I attempt to update the patch using Attachments_Form1.Updates the patch function complains because it only finds Attachments:
So, is Patch(FormName.Updates) for a New or Edit form or both?
Would I be able to use this within my current patch?
Thanks Warren,
Hi @golfnutt82 ,
The only way you can upload attachements directly from Power Apps is with an Attachment control in a Form, either by using SubmitForm() or Patch(FormName.Updates). It is possible using Power Automate to export the content (involves a hidden Image control and using JSON to get Base64 from that) and then using Add Attachment but this would also be one at a time as they are attached.
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.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional