I need to attach 3 files (PDFs) to each record in a CDS entity. I have enabled attachments on the entity. I am also making use of the "File" datatype (filetype) in the CDS entity. I have 3 "File" fields in the entity.
Through a form and I am able to upload and attach files to the 3 fields manually with no problems. The trouble is I have thousands of records in the entity and I need an automated way to upload and attach all these files to their corresponding records.
I have been experimenting with Power Automation, with no luck. The "Update a Record" action does not expose the "File" datatype fields. I read somewhere that the file attachments are stored in the "Note" entity, but the "File" datatype attachments are not.
Can you please help me figure out a practical way to automate this process?
Solved! Go to Solution.
The File type of field is still in preview so the Power Automate functionality for that field might not be all be ready. The only method I know is with Web API or the .NET SDK: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/file-attributes
You probably need to write some script in .NET or PowerShell to migrate the files...
Hope this helps...
Thank you very much @EricRegnier for your response.
Yes, I came across this article during my research. I am hoping I can accomplish my mission without having to go the .NET or PowerSell routs because I am not really savvy there.
However, I have just figured out how to upload the PDFs to the Attachment of my entity using the Note entity by using an Automation flow. I'm thinking about making a video about this. It took me forever to figure it out. I'm sure others would find it useful.
Worst case scenario, I can upload the 3 PDFs to the same record in my entity through the Note entity.
It would be really nice though, to know where the "File" datatype attachments are stored. That would make life a lot easier. I would appreciate it anyone knows.
Yes but attachments in notes activity are not the File field type. How will you move them to the file fields? Or are you planning on having notes attachments for history and file type fields for current and ongoing attachments?
You can use power automate to do this job. Using CDS connector you can upload the files to the entity in the file or image attribute.
just putting the following json in the content
"$content": "<base 64 string file>"
I hope that helps you. Please mark as a solution if help you.
Thank you all for your help and responses.
In light of this,
@EricRegnier I think I have no easy choice right now except to keep the files as Note Attachments instead of using the "File" datatype.
@Michaelfp Thank you for your help, I looked into the "Upload file or Image content" action, but I don't have it, I read somewhere that it is only available for USAGovernment.
@NHelgren Thanks for the info, now you have put my mind to rest and unfortunately I will have to use the Note Attachments for now until Microsoft provides an easier way to automate uploading to "File" datatype.
Thanks again everyone.
It´s not true.
I used in many non-USA Government instances. Take a look with you have the correct licenses or your instance is up to date.
I'm trying to upload email attachments using Flow. The Flow completes successfully, but when I download the attachment(s) I get an error that reads "Couldn't download - Server problem". I suspect it is because I did not convert the file to binary. In your json recommendation, you reference "<base 64 string file>". Within the context of Outlook attachments, how would I construct the base 64 string file--especially if there are multiple attachments?
Thanks in advance for any assistance you can lend.
The Super User program for 2022 - Season 2 has kicked off!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.