0
votes

I have a PowerApp connected to Common Data Services (CDS) very simple, just list products, add, remove or edit these products. But I have a more complex use case to solve: My user needs a button to import a CSV from App and this data should be loaded automatically in Common Data Services (CDS).

So, I tried some things but without success:

1) Create an attachment in a form, but I don't know how to make some process to read this attachment and load in CDS. 2) Put the Import Data button (https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/data-platform-import-export) in my UI, but this button just load "zip" exported from another PowerApp and this is not my case.

So, If not possible put a button to import CSV directly I can suggest to user import in another place but I don't know where, and should be very easy because my user don't have any IT Knowledges.

1

1 Answers

0
votes

There are a couple approaches you could try, but it will be an epic hack to get it to work! I was able to customize this Flow here, to get you ~80% of the way there (its getting late). See my version and a sample app here.

  1. Import the Flow into your environment
    1. Add the Create a record Common Data Service action to the last step
  2. Edit your PowerApp:
    1. Add an Edit Form control to your PowerApp
    2. Click Data Source and select your CDS table
    3. Click 'Fields' and add ONLY the Attachments field
    4. Set the Form Default Mode to Edit
    5. Insert an Image control. Set its Image property to First(yourAttachmentControlName.Attachments.Value).Value
    6. Insert a button control and select it
    7. Click Action then Power Automate and select the Flow you imported earlier.
    8. Epic hack time! Set the OnSelect property to:
Set(varCSV, imgDummyPic.Image); //whatever the name of your Image control is
Set(varCSV, JSON(imgDummyPic.Image,IncludeBinaryData));
CSV_TO_JSON_TO_CDS.Run(varCSV) //whatever the name of your Flow is

You can see all of this in action in the sample app. Connect the two, click the button, and dissect the results.