Power Automate: Get Attachment from a File Field Type in CDS and send as Email

The new field in CDS is a very nice feature and looks really cool!

Here is how it created in CDS entity:

  1. On your CDS entity click on Add Field

2. Add the Field Name and Select Data Type File and then add the field to your form

This is how it looks on your form:

Then we now want to work with Power Automated and get the attachment and send it in an email:

  1. Set the flow trigger to be on Update of an account as below:

2. Call the Get File/Image Content Action and pass the Account Id as the Item Id and select the Field Name if you have multiple File Types fields added to your entity.

But this gets only the File Content but what about the File name …. ? I took me a little bit to sort it out.

3. We have to Query the File Attachments entity to get the File Name as below:

_objectid_value corresponds to the record id

regardingfieldname corresponds to your create File Schema Name

4. To Get the file name using a variable or Compose Data Operation and set it to the below,

Where List_records can be replaced by your List Records Action.

first(outputs('List_records')?['body/value'])['filename']

5.Create Send Email Action and use the output of the Compose as the File Name and the output of the Get file or image content as the Field Content and Test your Flow!

Hopefully this is useful!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: