Transition effect on Gallery Items when hovered over in a Canvas Power App | [Quick Tip]

While using a Canvas App on Desktop, or when it’s embedded in Dynamics 365 CE, it’s a nice design decision to highlight the Gallery items on which your mouse is pointing on as you navigate/scroll.

Default Behavior

By Default, the Gallery Items remain visually static and don’t show any effect if you move your mouse over the items.


That’s because the Transition effect on the Gallery items is set to None by default.

Transition Effects on Gallery Items [Pop & Push]

As you’ve seen the Default behavior, let’s also look at the 2 effects that are available to us

Pop

  1. Select the Gallery and then on the right-hand side, look for Transition field, it’ll be set to None by default. Change it to Pop.


    Now, in Pop, the effect will be as below –


Push

Similarly, like Pop, Push will have the reverse effeect of pressing into the item hovered.

  1. Again, when Gallery is selected, set the Transition to Push in the menu, save the changes and check again.


    The Push effect will be as follows –

Here’s a quick YouTube video for the same –

Hope this was useful!

Here are some more Canvas Power Apps posts you might want to check –

  1. Navigate Screen automatically based on Timer in Canvas Power App | Power Platform
  2. Search on multiple columns from a Dataverse table in a Canvas Power App Gallery control | Power Platform
  3. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  4. Call a Flow from Canvas Power App and get back response | Power Platform
  5. Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip
  6. Retrieve Hashtags from Text in a Canvas Power App | Power Platform
  7. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  8. Implement character length validation in a Canvas Power App | Power Platform
  9. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  10. Aggregate functions in a Canvas Power App | Using on SharePoint Lists

Thank you!

Navigate Screen automatically based on Timer in Canvas Power App | Power Platform

So let’s say you want to auto-navigate from a Screen to some other Screen in a Canvas Power App. [Or any other operation for that matter!]


The purpose of this post is to demonstrate how you can use a Timer control in Canvas Power App to automate some operations in your Canvas Power App!! So let’s see this scenario of navigating between screens

Scenario

Let’s consider this scenario. You want to display a Splash Screen on your App upon submission of a record notifying the user about some short info and then redirecting to the Main Screen. You don’t want the user to press a button but only want to redirect automatically after 4 seconds, for example.

  1. Here’s your Home Screen, Main Screen and Success Splash Screen.
    In this scenario, you want to create a New Record in NewAccountScreen, then redirect to SuccessScreen upon record submission.
    And once the timer times out as specified, you need to redirect from SuccessScreen to Home Screen.


    Here’s how the Success Screen will look –

Using Timer to Navigate between Screens

Now, let’s look at how we can achieve this –

  1. Take a Timer control on the SuccessScreen. Here’s how you can add a Timer from the Input menu.


  2. Now, the Timer will appear as below. You will need to hide this later on. For now, we’ll keep this on screen to see the behavior and design the logic.

  3. Now, we need to set a few parameters of the Timer –
    Duration, you can specify in milliseconds here. Example: 3000 i.e. 3 seconds

  4. Next, you’ll need to set the Start flag. By default, this is set to false. The Start is triggered when the value it set to True. This needs to be dynamically set from elsewhere i.e. in this example, you’ll need to trigger from where you come to this screen so that the Timer starts the countdown.


  5. Now, the way I set this is, first I create a variable from the place where I want to trigger the Timer to go-off. From the Form Submission screen in this case.
    Now, if you see below, I’m Submitting the Form i.e. creating a new record. Then, I’m navigating to the SuccessScreen. And, finally, I’m creating and setting a variable called startTimer and set the value to true. As the Start property of the Timer accepts a Boolean value.


    Then, I’ll set this variable to the Start.


  6. Then, you’ll need to set what needs to happens when the Timer ends. So, you have to write the OnTimerEnd property as to what will happen once the Timer ends.
    Here, you’ll Navigate to the ‘Home Screen’ as per our scenario and then also, set the startTimer flag to ‘false’ since you want to reuse this again for the next submission.

  7. That’s it!! Let’s see how this will work. And you can absolutely have any different scenario which you want to do with a Timer.

Also, here’s the Microsoft Documentation on the Timer Control for Canvas Power Apps – https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-timer?WT.mc_id=DX-MVP-5003911

Working

So, here’s how it will behave. For demo purpose, I’ve kept the Timer visible on screen for you to see it in action –

Hope this was helpful!

Here are some more Canvas Power Apps posts you might want to look at –

  1. Search on multiple columns from a Dataverse table in a Canvas Power App Gallery control | Power Platform
  2. Call a Flow from Canvas Power App and get back response | Power Platform
  3. Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip
  4. Retrieve Hashtags from Text in a Canvas Power App | Power Platform
  5. Rich Text Control for Canvas and Model-Driven App | Quick Tip
  6. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  7. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  8. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  9. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  10. Implement character length validation in a Canvas Power App | Power Platform
  11. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  12. Variables in Canvas Power Apps | Global and Context

Thank you!

Search on multiple columns from a Dataverse table in a Canvas Power App Gallery control | Power Platform

One of the most common scenarios is to be able to perform a Search on the Dataverse table like Accounts, Contacts etc. across multiple columns. Just like you would do on a Quick Search in a Dynamics 365 CE (CRM).

Let’s see how we can replicate this using Search() function in Canvas Power App to implement Search across multiple columns in a Canvas Power App.

Gallery and Search Control

As a typical setup, I’ll implement a Gallery control to populate all Accounts and have the Search Text Input control for the user to enter the search term. Let’s see how we can set this up quickly –

  1. I’ve added a Gallery control that will populate the Accounts from the Dynamics 365 (Dataverse) instance and I’ve added a Search which is a Text Input which user can use to enter the Search term.


  2. Here are the fields which are selected to be displayed on the Gallery. Account Name will be shown larger in bold and below is the City to give it a subtitled look.


  3. Once this is set, we’ll look for Items of the Gallery and proceed to modify it. You’ll see the Default Items populated already based on how you populated the Gallery when you connected to your Dataverse.
    Let’s modify this.


  4. Now, we’ll clear the Items formula bar and then write the below Search() function –

    Search – Denoted by Blue arrow, Search() function is used in Canvas Apps to Search from a Data Source but first selecting thee data source in the first parameter, then the Search Term and finally listing all thee columns of the data source separated by commas. Here’s thee official documentation of the Search functionality as provided in Microsoft – Docs https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup?WT.mc_id=DX-MVP-5003911

    Accounts – Denoted by Green Arrow, Accounts if the Data Source i.e. thee Dataverse environment which is fetching theee Accounts table and populating the Gallery.

    SearchInput.Text – Denoted by Orange arrow, SearchInput.Text is the text which users will enter to Search from the Dataverse i.e. from Accounts table in order to show up.

    Fields – Denoted by Red Underline, the fields can be listed from the Data Source and the Search will be carried out amongst those columns.

Working

Now, let’s see how this will work –

  1. By default, if the Search Box is blank, all the records will be shown.


  2. Once, users start to enter text into the same, the Items of the Gallery will start populating based on the Search.


    I’ve also implemented this using the Filter function as well – Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform

Hope this was useful!

Here are some more Canvas Power App posts you might want to check out –

  1. Call a Flow from Canvas Power App and get back response | Power Platform
  2. Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip
  3. Retrieve Hashtags from Text in a Canvas Power App | Power Platform
  4. Rich Text Control for Canvas and Model-Driven App | Quick Tip
  5. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  6. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  7. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  8. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  9. Debug Published Canvas Power App with other users using Monitor | Power Platform
  10. Download a File from a Canvas Power App using a button | Power Platform
  11. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform

    Thank you!!

Call a Flow from Canvas Power App and get back response | Power Platform

One of the most commonly searched topic is being able to Run a Flow from a Canvas App. And this has been demonstrated by many users over a period of time.

This is my attempt to summarize the same. Hopefully, this will clear out in a simpler way!!

Scenario

In this scenario, I will call a Flow using a Button and send the number in the TextBox, the Flow will do some calculation and I will get back the result which I’ll use to store and utilize. Simple!

Create a Flow

Let’s see how you can add a Flow to Canvas Power App –

Before we begin, remember, only the Flows which are outside a solution will be recognized inside a Canvas App.

  1. Here is my Cloud Flow. Since the Trigger of the Flow is a Canvas Power App, I’ll search for PowerApp in the Connectors and select the PowerApps connector.
    It has 1 trigger which is called as PowerApps.


  2. Once I select, I start the Flow with the trigger and then I’ll go on to declare 2 variables to do a simple operation.


  3. Now, I want to request Number 1 in the Canvas PowerApp which will be passed to the Flow.
    So, in the Dynamic content, you’ll notice Ask in PowerApps

  4. As I select this, a variable will be auto-created with will be the name of the variable “Number 1” (spaces will be removed), followed by _Value. Hence, resulting in Number1_Value.


  5. Next, I’ll create another variable to just multiply these 2 numbers together and produce a result. So, here’s my third variable. (Just for the sake of this example 😊)


  6. Now, to send back a Response to the calling Canvas PowerApp, I’ll again search for PowerApps connector in which and then look for the Action which is called as Respond in Power App

  7. Once I select that, I can then pass on my variable which is a result of my calculation.


  8. And I’ll send the result back to the calling PowerApp.

Accepting Parameters in Flow from Canvas App

Let’s look at the other part of the implementation where I will have a button pass value to the Flow and get back results.

  1. In my Canvas App, I have this structure where I have a Textbox called ‘ValueToSend‘, a button called ‘ProcessButton‘ and a DataTable called ‘ResultTable‘ to show the result.

  2. Now, in order to add a Flow on the trigger of the Process Selected button, I’ll select the button first and then make sure OnSelect is highlighted and then follow the step below.
  3. Now, let me add the Flow to the App first. I’ll navigate to Action and click on Flow.

  4. Upon selecting Power Automate, I’ll be shown all the Power Automate Flows detected by the App. Remember, only ones NOT in Solutions will be detected and available for selection.

  5. Upon clicking it, it will be added to the Power App and appear in the Data above and the Flow will be ready in the Formula Bar for you to complete calling it.


  6. Now, as you click on the Formula Bar to start writing the Flow, you’ll be asked the first parameter which we added as Ask In PowerApps in our Flow above.

  7. So, I’ll enter the TextBox which I had created i.e. ValueToSend, for example. And then close the Flow and then enter a dot to select the Outputs for Flow has to offer.
    As you see, I can now select the Output Parameters which we had selected.

  8. Once I select that, the Flow will send the value that I pass and collect back the calculatedValue from the Flow.



  9. Now, this is not stored anywhere, so it’s recommended you store it in a Variable/Collection for your use later.
    In my case, I’ll add it all to a Collection to populate the DataTable later on. Hence, I’ll add the entire thing to the Collect() method


  10. Next, since I want to display thee result in the label, I’ll assign the Label’s Text property to the variable I created above and collected Flow result in.


    Now, let’s Run this example.

Running

Now, when I call the Flow by pressing the button once I enter some value, the result will be calculated and the Collection will store the answers sent back by the Flow and it’ll keep adding to the collection on each request.

Likewise, your scenario could be anything per your implementation.

  1. First call to Flow


  2. Second call to Flow

Hope this was useful!!

Here are some more Canvas Power App posts you might want to check out –

  1. Retrieve Hashtags from Text in a Canvas Power App | Power Platform
  2. Rich Text Control for Canvas and Model-Driven App | Quick Tip
  3. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  4. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  5. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  6. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  7. Debug Published Canvas Power App with other users using Monitor | Power Platform
  8. Download a File from a Canvas Power App using a button | Power Platform
  9. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  10. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
  11. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  12. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists

Thank you!

Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip

In case you want to enable PCF Controls to be allowed to be embedded in a Canvas Power App, here’s what you do.

Default Behavior

By default, if you see as below i.e. you are not able to Import Code Components (PCF Components) into your Power App and see the below –

  1. In order to Import a Code Components in a Canvas App, you navigate to Insert tab and then expand Custom and click on Import Components.


  2. But, only Components published from other Canvas Apps are available to import.


    So here’s how you can first enable the ability to import Custom Code Components in Canvas Power Apps.



Power Platform Admin Settings

It is possible that this setting is turned off by default. Here’s what you need to do to turn it back on –

  1. Navigate to Environments’ section in Power Platform Admin Center (https://admin.powerplatform.microsoft.com/environments). Make sure you are into the environment where you are building this App in.
    Alternatively, you can also select the environment and click on Settings from the top ribbon.


  2. Once in the environment, click on Settings. (As I mentioned above, you can also access this from the Environments section itself without entering the Environment altogether)


  3. Once in Settings, expand Settings tab and go in Features.


  4. Once you open Features, you’ll find the Power App Component Framework settings on the right which might be turned off.


  5. Now, turn this ON and Save changes.


  6. Also, as an additional check also make sure the App too has enabled Components to be included in the App. This is available in the Advanced Settings of the Canvas App itself.



    Assuming you have turned that ON. Now, you can go in your Canvas Power App and Import Code Components.


Import Code Components in Canvas Power Apps

Now, let’s say you have already turned on Power Apps component framework settings for canvas apps as shown above.

  1. In you Canvas App, click on Import Components as shown below.


  2. And now, you should be able to also see a section called as Code where custom code components will appear.


  3. Let’s say you have imported this component, it will be available to use in the + menu in the Canvas App Studio.

Hope this was useful. Here are some more Power Apps / Power Platform posts you might want to check out –

  1. Rich Text Control for Canvas and Model-Driven App | Quick Tip
  2. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  3. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  4. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  5. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  6. Implement character length validation in a Canvas Power App | Power Platform
  7. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  8. Debug Published Canvas Power App with other users using Monitor | Power Platform
  9. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  10. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps

Thank you!

Rich Text Control for Canvas and Model-Driven App | Quick Tip

In one of my previous posts, I had highlighted, you can enable a Rich-Text Control for a Multiple-Line of Text type of field. Here it is again – Use Rich-Text Control for Multiple Lines of Text in Dynamics 365 CE | Quick Tip

In the above post, I had highlighted that we can change the control of a Model-Driven control of Text to Rich-Text and make it appear as below

Now, reading the same field in a Canvas App will make it appear as below

Now, let’s see how we can overcome this and read the correct Rich-Text Control formatting in the Canvas App’s Form as well.

Canvas App Form

Let’s look at the changes you’ll need to do to the Gallery control in order to read the Rich-text formatting as seen in the Model-Driven App

  1. Select the Gallery itself and expand the Fields section and locate the field which is a Rich-Text control in the Model-Driven app itself.

  2. Now, change the Control type and select the Edit rich text control from the options.


  3. Once this is selected, the Control will be updated to read formatting as in the Model-Driven app itself.

Hope this was helpful. Here are some more Power Apps / Power Platform posts you might want to check –

  1. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  2. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  3. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  4. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  5. Debug Published Canvas Power App with other users using Monitor | Power Platform
  6. Download a File from a Canvas Power App using a button | Power Platform
  7. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  8. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  9. Implement character length validation in a Canvas Power App | Power Platform
  10. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App

Thank you!!

Multi-select Items from Gallery and adding/removing them from Collections | Power Platform

Now, let’s say you want to be able to select a few Gallery Items and the same should be populated to a Gallery and even from Collection as well.

You can use this scenario if you want to create a Collection of some GUIDs/Account Names and then take separate action on it or handle it in some other context.

Add Check box in a Gallery

Let’s take a simple example-

  1. I added a Check Box in a simple Gallery list.


  2. Align as per your preference. It also comes with a Default “Option” label which you can remove.


  3. Now, there are 2 properties which you can use to add to a Collection and remove from the same collection.
    Let’s look at the first one – OnCheck


  4. Under OnCheck function, I’ll add the current item to the Collection (A new collection will be created if not already created)
    Blue denotes function used to create a Collection. Collect() function – Microsoft Documentation on the Collect() function – https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clear-collect-clearcollect?WT.mc_id=DX-MVP-5003911
    Green arrow denotes the name of the Collection I’m creating.
    Red arrow denotes the current Item from the Gallery control and the Account Name field which I want to populate in my collection.
    This will add the Account Name of the record to the Collection once the Check box is checked.


  5. Under OnUncheck function, I’ll add the formula to remove the current Item from the Collection.
    Blue denotes the function used to remove a value from the Collection. Microsoft Documentation of the same is here – https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif?WT.mc_id=DX-MVP-5003911
    Green arrow denotes the name of the Collection from which I have to remove the value.
    Red arrow denotes the current Item which I had added to the Collection when the Box was checked. It’ll use the same reference.
    This will Remove the Account Name which was added to the Collection when the checkbox was checked.


    For simplicity, I’m taking Account Names to show in the Collection, you can create a structure in Collection and map Item values as per your needs.

Changes in Collection (Using Data table to visualize)

Just to show/visualize how the Collection will look when I interact with the Check boxes on the Gallery, I’ve added a Data table to keep the demonstration simple.



And populate the Items with the Collection’s Value. Because all the Account Names we added to Collection while marking Check box as Checked will fall under .Value

Working

As you select and unselect items from the Gallery, they are added to and removed from the Collection which is seen in the Data Table below.

Hope this helps!!

Here are some more Canvas Power Apps related posts you might want to check out –

  1. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  2. Implement character length validation in a Canvas Power App | Power Platform
  3. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  4. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  5. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  6. Debug Published Canvas Power App with other users using Monitor | Power Platform
  7. Download a File from a Canvas Power App using a button | Power Platform
  8. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  9. Logged In User details in a Canvas Power App
  10. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform
  11. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  12. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App

    Thank you!

Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]

If you are new to creating a Canvas App and you’ve just added a Form and when you try to run and test the same in the browser itself, you don’t see it.

So let’s say you’ve put a form like this

And all you see is this –

So this happens based on the Default Mode and whether the context is passed to the form depending on the type or not.

Default Mode

There are 3 Default Modes for a form and it’s critical which one should be used when –


1. Edit – To be used if you are creating a new record. While using this mode, make sure the Item (from a data source is passed to the Form itself. Else, you’ll see the same error message as above and won’t see a blank form in that case.)
The Item property should be pointed to pick .Selected i.e. typically, <GalleryName>.Selected.


Context of a record i.e. a Row should be passed on to this form for Edit mode i.e. an existing row to be passed on to this Form from the preceding Gallery/Table control (or any data source based on your implementation). For example – The context I send to the form looks like this.
The last parameter i.e. <GalleryName>.Selected is placed on the select button so that once clicked, it’ll send the record context over to the form so that the form is displaying the selected record (which is picked from Item property in the above screenshot)

2. New – New should be used if the Form you’ve inserted isn’t coming as a result of populating a selected record. But you will enter new values and Submit it the first time.
Once New is selected, the form will correctly render for you when you test or run the App once correct Mode is selected (i.e. you don’t intend to pass any context to the Form)

3. View – In this view, fields will not be visible and instead the data will be a result of the selected item from the List/Gallery view it is coming from i.e. a Data Row which will populate this form. This will be a Read-Only view.
Another form example where View is selected, fields won’t show up but this form would need Context to be passed to it just like in the New mode.

Hope this quick tip was useful.

Here are some more Dynamics 365 related posts you might want to check

  1. Find deprecated JS code used in your Dynamics 365 environment | Dynamics 365 v9 JS Validator tool | XrmToolBox
  2. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  3. Track and Set Regarding are disabled for Appointments in Dynamics 365 App For Outlook message | Demystified
  4. Cancelled Bookings Imported in Time Entries in Dynamics 365 PSA issue | [Quick Tip]
  5. Remove ‘This Email has been blocked due to potentially harmful content.’ message in Dynamics 365 Emails | OrgDbSettings utility
  6. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  7. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  8. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]

Thank you!!

Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform

Although, you can use Text based controls to represent data as is in a Canvas Power App. So why not go an extra mile to make it look more intuitive.

Scenario

Let’s say there are Accounts and you have some kind of Compliance Ratings on them to represent compliant they are based on certain criteria. Could be a Numeric value or Decimal value. But Rating Control represents only in Numeric i.e. Whole Numbers.

So, for this example, I’m using a Rating field which is of type Whole Number in Dynamics 365 on Account entity.

And the complete Dataset looks like this in Dynamics 365 / Dataverse.

Note: I tried with Decimal but it rounded the values hence, sticking to Whole Number.

Rating Control

  1. Let’s say below is the Gallery and you want to show Ratings in the form of stars instead of traditional numeric values.

  2. Now, let’s use Rating Control below the Names of the Accounts to show the Rating values. Select the first Row once you connect to the Common Data Service i.e. CDS / Dataverse Data Source and select the entity you want to populate it with. In this example, we are using Accounts. So my Gallery is populated with Accounts records.
    Select the first record and navigate to Insert tab and look for Input controls as shown below


    Now, look for Rating control.

  3. Once you select Rating, it’ll appear iteratively since it’ll be applied “For Each” of these records in your Gallery control.


  4. I’ve just rearranged them under the name to make them look proper.

  5. Let’s make it Read Only by changing the behavior, so that the Users don’t accidently touch and set a value during Runtime. Although, this won’t affect the actual data but the representation will be incorrect in that case.

  6. Also, the Max will represent the length of your Rating whereas the Default value are kept to 0 in case the field value is not set at Source. (I think 1 would still be misrepresenting)

  7. Now, I’ll connect this Control to the Data Source’s field i.e. Rating field on the Account entity that represents the Rating value.
    On the Default, I’m setting ThisItem.Rating where ThisItem represents the Row of the Account i.e. the Account record itself and Rating is the field in Dynamics 365’s Account entity which we saw in the scenario above.


  8. And that’s it. You can Save and Publish your App and Run it.

Rating values

Now that we’ve added the Rating Control, let’s Run our App and see how it represents the data from your Accounts entity.

And the Ratings represent the below data –

Hope this was useful!

Here are some more Canvas Power Apps posts you might want to check –

  1. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  2. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  3. Debug Published Canvas Power App with other users using Monitor | Power Platform
  4. Download a File from a Canvas Power App using a button | Power Platform
  5. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  6. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  7. Implement character length validation in a Canvas Power App | Power Platform
  8. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
  9. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  10. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  11. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform
  12. Restore older version of a Canvas Power App | Power Platform

Thank you!!

Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service

Mostly, Gallery and Forms are used to work with CDS (Common Data Service) Entities data are in Dynamics 365 like Accounts, Contacts, Opportunities etc.

Some of the common field level metadata info you can retrieve is: MinValue, MaxValue, MaxLength of a field. This is dependent on whether it is supported/provided by Data Source itself, be it CDS or any other Data Source, depends.

You can leverage DataSourceInfo function to enrich your CDS form in a Canvas Power App by showing some metadata about fields. Something like below –

DataSourceInfo function

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

Not necessarily all DataSources will provide all information.

In this post, I’m trying to show some metadata of the Dynamics 365 using CDS Data Source.

Microsoft’s official documentation on DataSourceInfo https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-datasourceinfo?WT.mc_id=DX-MVP-5003911
In my example, I’ve added some 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 lengthy fields such as a Multi-line Text Field in Dynamics 365 CRM.

  1. Let’s say Description field in Dynamics 365 has Length provided as 600

  2. I’ve placed maxLen label below the Description field

  3. And the formula is to show the info “Max Length: <value>” is written using Concatenate() function so that I can add some text as I want to make it look more informative.

    In the above formula, in Text() function, I’ve written
    DataSourceInfo in blue. That is the formula that will take arguments like Data Source, DataSourceInfo.<Function> & Column name.
    Accounts marked by showing orange arrow 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.

To enrich this feature, you can use this to dynamically show how much more characters are remaining in real-time as the user types into the field. Refer this post – Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform


MinValue & MaxValue

MaxValue & MinValue are used to show the minimum & maximum value allowed in the field. Most apt is having Numeric fields in Dynamics 365 CRM.

  1. Let’s say Grading is a custom field called as Grading which is Whole Number.

  2. I’ve placed minVal and maxVal labels below Grading field in the Canvas Power App.

  3. And the formula is to show the info “Min : <value>” & “Max: <value>” is written using Concatenate() function so that I can add some text as I want to make it look more informative.

    In the above formula, in Text() function, I’ve written
    DataSourceInfo in blue. That is the formula that will take arguments like Data Source, DataSourceInfo.<Function> & Column name.
    Accounts marked by showing orange arrow is the Data Source itself since it is connected to Accounts entity in Dynamics 365.
    MinValue and MaxValue is the attribute which will tell us Minimum & Maximum allowed data values for the field user can enter  in the field in the next parameter.
    new_grading denotes the name of the column in double-quotes of which we want to know the Minimum allowed Value and Maximum allowed Value.

Hope this is useful!

Here are some more Canvas Power Apps posts you might want to check out

  1. Restore older version of a Canvas Power App | Power Platform
  2. Debug Published Canvas Power App with other users using Monitor | Power Platform
  3. Download a File from a Canvas Power App using a button | Power Platform
  4. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  5. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  6. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
  7. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  8. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  9. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists
  10. Aggregate functions in a Canvas Power App | Using on SharePoint Lists
  11. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  12. Correctly connect to an Excel file in a Canvas PowerApp

Thank you!!