Gallery and Forms work with Common Data Service Entities data from Dynamics 365 like Accounts, Contacts, and Opportunities.

We can retrieve some common field-level metadata info like the MinValue, MaxValue, and MaxLength of a field.

We can leverage the DataSourceInfo function to enrich your Common Data Service form in a Canvas Power App by showing some metadata about fields. Something like the below screenshot.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

DataSourceInfo function

DataSourceInfo is a function that provides some information about the DataSource itself or the columns present in the Data Source.

In this article, I'm trying to show some metadata field values from Dynamics 365 using CDS Data Source.

I have created a sample canvas app and added a few labels to show these values.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

MaxLength

MaxLength is used to show the maximum allowed capacity of a field. Most useful to show the maximum length of fields, such as a Multi-line Text Field in Dynamics 365 CRM.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

I placed the maxLen label below the Description field and added the formula in the Text() function.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

In the above formula, in the Text () function, I have written

MinValue & MaxValue

MaxValue & MinValue are used to show the minimum & maximum value allowed in the fields in Dynamics 365 CRM.

Let's have Shares Outstanding as a custom field which is Whole Number.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

I have placed minVal and maxVal labels below the Shares Outstanding field in the Canvas Power App.

Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function

In the above formula, in the Text () function, I have written