web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Uploading a file along...
Power Apps
Answered

Uploading a file along with Form Details in Document Library

(0) ShareShare
ReportReport
Posted on by 1,059

Hi,

I have a form which have some text input fields, Add Picture Control and Barcode Scanner Control

I want to Save the Text fields, Selected PDF, Excel file from picture control an scanned barcode to a document library list at the same time. Add picture control needs a button flow to upload a file to the document library. 

My Code: on SUBMIT BUTTON

UploadFileToLibrary.Run(UploadFileButton.Media,UploadFileButton.FileName)


Patch(
 'Vaccine Tracking List',
 Defaults('Vaccine Tracking List'),
 {
 
 EmpEmail: EmpEmailInput.Text,
 'Date of Certification': DataCardValue5.SelectedDate,
 VaccineType: DataCardValue6.Selected,
 CertificateNumber: DataCardValue7.Text,
 File: ???
 }
 );
 
Navigate(View,None);
ResetForm(Form1)




I want to include that in my patch command, I am confused any guide? 

FormDetials.png

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @MH3 

    Why are you Patching an edit form??

    You should be using the SubmitForm action to update what you need.

     

    However, with either method your challenge is that you need to create the record first by adding a file...then from that you can alter the item properties.

    Typically this is done by passing not only the file, but also the metadata associated with the record to the flow and then the flow will create the library record and then assign the metadata to it.

     

    If you decide not to send the metadata to flow, then you have to do a little switch around on the form to get it to work.

    In this scenario the concept is working with creating a new file in the doc library (as opposed to viewing and editing).

     

    Set the Item property of the Form to : Colaesce(lclNewRec, Defaults(yourDocLibrary))

    In your Submit button OnSelect action:

    With({flowResultID: UploadFileToLibrary.Run(UploadFileButton.Media,UploadFileButton.FileName).recordID},
    
     UpdateContext({lclNewRec: Patch(LookUp(yourDocLibrary, ID=flowResultID), yourForm.Updates})
    );
    
    SubmitForm(yourForm)
    
    

     

    You will need to change your flow to return the ID of the record that was created when you create the file in the library to a result called recordID

     

    What the above does is then patches the result from the flow with the values that have already been entered on the form.  This will keep them all there on the form rather than blanking them out.

     

    The final bit is just to do a normal submitform on the form.

     

    This method works well for creating new library files and having a form for the metadata.

     

    I hope this is helpful for you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard