File and Image type attributes now supported in Model Driven Power Apps with 2020 Release Wave 1

Sending
User Review
0 (0 votes)

Until the introduction on these new data types, the only options for storing files had been the notes section. Enable notes for the entity and attach files in the notes section. Well there was Entity Image that has been available for some time now but that only allowed for one single image to be associated with a record and the image uploaded would be auto resized and therefore, required the images uploaded to be of certain dimensions to be of practical use.

File Data Type:

In comes the File field type about a few months ago.

File and Image type attributes

But until now, it only had support through either code or canvas apps. Which means there was not an option to provide any sort of UI for the user to upload/download files to this attribute through model driven apps which actually hindered its adoption.

In the latest Release Wave, the file type field can be added to form and users now have the ability to upload/download file.

File and Image type attributes

Save the record before these controls are enabled to select the file/image for upload.

File and Image type attributes

The actual files in file data type are stored in the File Storage and not in CDS so they do not consume database space.

Max Size Supported is 128MB.

Docs reference: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/file-attributes

Image Data Type:

And this week, noticed the new data type Image available when adding new fields. As the name suggests you can store image files in this field.

File and Image type attributes

Few important properties to note here:

Primary Image – If you check the box, this image field will replace the entity image as the default image for the record. This means that any image uploaded to this field becomes the record image that is displayed on the record header.

File and Image type attributes

Can Store Full Image: This option lets the platform know if you would like to store the full image along with the thumbnail image.

If you have chosen the full image option, the image file is stored in File Storage not in CDS. The CDS will only store thumbnails and image metadata.

Max Image Size Supported is 30MB.

This field can be added to the form and as shown in the screenshot above, you can even annotate and edit the image and that would be stored as well.

Docs reference: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/image-attributes

Are they available with Power Automate Flow?

Yes, the Common Data Service (Current) connector already includes support for these data types. In this quick sample flow shown below, I have demonstrated the ability to read the image uploaded using the image attribute and send it out as an email attachment.

You could also send the content of the image to the Predict Action of CDS (Current) for processing through an Object Detection Model.File and Image type attributes

The flow is triggered every time the image attribute is updated. Note since we are not allowed to upload image until the record is saved, the image will only be updated when the record is updated.

Note, a retrieve multiple or get record will not return the image attribute details unless the attribute is specifically requested, therefore the image attributes have been passed in the Get a Record Action above. Each image field added will auto generate an image id field for the same.

Check if the image has any content – if yes, we have used the Get File or Image Content action to demo the ability to read the file/image attribute content.

Choose the entity which has the image/file attribute, pass the entity record id in the Item Id and choose the field name of the image/file that you would like to retrieve. Note we are now allowed to create multiple image/file attributes in a single entity and therefore provide the name of the appropriate field.

Notice the Image size property – this can be used to specify if you would like to read the full image or the thumbnail of the image.

File and Image type attributes

Check if file content successfully read and then in the Send an email action of outlook connector the output of Get File or Image Action step is passed in Attachment content.

With this done, any time an image is uploaded you will receive an email with the file attached along.

Note: Get Record action with the list of image attributes provided above, also returns the image content and therefore, there is no need to again use  Get File or Image Content action. This has been included to demonstrate the various actions available to support the File and Image attributes.