PowerPlatformConnectors icon indicating copy to clipboard operation
PowerPlatformConnectors copied to clipboard

[FEATURE REQUEST] Add Attachment Data Card and Enhance Patch Function to Handle Attachments in Power Apps

Open mateusperes15 opened this issue 1 year ago • 0 comments

Type of Connector

Certified Connector

Name of Connector

Function Patch

Is your feature request related to a problem? Please describe.

Attaching a file and uploading this data in Power Apps is currently a cumbersome process with two main workarounds:

  1. Using Power Automate:

    • Create a form to access the attachment data card, copy it, and paste it outside the form, then delete the form.
    • Use the Patch function to create a new record and store the ID in a variable.
    • Call a Power Automate flow, passing the file in a document variable and referencing the ID to store the attachment in the correct list item.

    For example:

    Set(VarID; Patch(List; Defaults(List); { Name: Mateus; Age: 18 } ).ID);; Upload_PDF.Run(VarID;{file:{contentBytes:First(DataCard1.Attachments).Value;name: First(PDF.Attachments).Name}})

  2. Without Using Power Automate:

    • Create a form and keep only the attachment data card.
    • Use the Patch function to create a new record, then use Form.Updates to handle the attachment upload directly.

    For example:

  3. Create a Form (Name: Form1)

  4. Put the list in Item

  5. I only leave the data card attachment.

  6. Make the normal Patch and place Form1.Updates at the end

Patch(List; Defaults(List); { Name: Mateus; Age: 18 }; Form1.Updates )

Both methods are complex and involve unnecessary steps.

Describe the solution you'd like

Suggested Improvement:

  1. Develop a standalone attachment data card that can be added directly to a data entry form without needing to copy from an edit form.

  2. Adapt the Patch function to handle attachments directly from this data card, eliminating the need for Power Automate in simple scenarios. For example:

    PowerApps Patch( Lista, Default(Lista), { Nome: "Mateus", Idade: 20, Sexo: "Masculino" }, NewDataCard.Attachments )

Instead of referencing the ".updates" form, simply enter the NewDataCard.attachamments data input and the patch will create the file with the appended content and the appended file name

Describe alternatives you've considered

Currently, I need to create an edit form, copy the default attachment data card, and paste it on a blank page, then delete the form because it’s the only way to get this data card. Alternatively, I create a form, keep only the attachment data card, and use Form.Updates at the end of the Patch function.

Additional context

Benefits:

  • Simplifies the process of attaching and uploading files.
  • Reduces the need for additional Power Automate flows.
  • Enhances user experience by providing a more integrated solution.

mateusperes15 avatar Jul 15 '24 22:07 mateusperes15