Get Dynamic 365 field metadata in a canvas app using DataSourceinfo function.
Gallery and
Forms are used to work with Common Data Service Entities data from Dynamics 365
like Accounts, Contacts and Opportunities.
We can
retrieve Some of the common field level metadata info like MinValue, MaxValue
and MaxLength of a field.
We can
leverage DataSourceInfo function to enrich your Common Data Service form in a
Canvas Power App by showing some metadata about fields. Something like below
screen shot.
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 fields values from Dynamics 365 using CDS Data
Source.
I have
create a sample canvas app and added few labels to show these values.
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.
I have
placed maxLen label below the Description field and added formula in Text()
function.
In the above
formula, in Text() function, I have written
DataSourceInfo
is the formula that will take arguments like Data Source, DataSourceInfo.<Function>
& Column name.
Accounts is
the Data Source itself since it is connected to Accounts entity in Dynamics
365.
MaxLength is
the attribute which will tell us the Maximum allowed length for the field we
will enter next.
"description"
denotes the name of the column in double-quotes of which we want to know the
MaxLength.
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 is a custom field which is Whole Number.
I have
placed minVal and maxVal labels below Shares Outstanding field in the Canvas
Power App.
In the above
formula, in Text() function, I have written
DataSourceInfo
is the formula that will take arguments like Data Source, DataSourceInfo. <Function>
& Column name.
Accounts is
the Data Source itself since it is connected to Accounts entity in Dynamics
365.
MinValue and
MaxValue are the attributes which will tell us Minimum & Maximum allowed
data values for the field user can enter in the field in the next parameter.
"Shares
Outstanding" denotes the name of the column in double-quotes of which we
want to know the Minimum and Maximum allowed Value.
Comments
Post a Comment