We will learn and understand the delegation warning in Canvas App with practical examples. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in field of Dynamics 365 CRM.
What is delegation?
The “Delegation” is where the expressiveness of Canvas Apps formulas suffice the need to minimize data moving over the network.
As a app customizer / developer, the delegation is a very important concept to understand, especially if you are working with large sets of data in PowerApps. For example, when performing data operations like searching and filtering for specific records the delegation offloads the work to the data source. In simple words, it means that the operations like Filter, Lookup, and Search are performed at the data source instead of bringing the complete set of data to the application and then processing it locally.
Possible reasons of getting delegation warning –
If the delegation warning appears while performing operations in your formulas, it means that your operations cannot be offloaded for one of several reasons:
- Filter, Search, and LookUp can be delegated.
- Sort and SortByColumns can be delegated.
- Sum, Average, Min, and Max can be delegated.
Non-delegable limits in Canvas Apps-
The formulas which cannot get delegated will be processed locally. If these formula involve the retrieval of large chunk of data then all the data must be brought to the device first which can result in slowness of the application. To avoid this, Power Apps imposes a limit on the amount of data that can be processed locally: 500 records by default.
Changing delegation limit in Canvas Apps –
We can change the default number of rows which are retrieved from server – based connections where delegation is not supported with the below steps.
- Open the Canvas App in https://make.powerapps.com/ editor as shown below.
- In the ribbon bar, click on Settings and navigate to the General tab.
- Search for the area “Data row limit” as shown below. Here we can change the limit of row retrieval from 1 to 2000.
- In some cases, you’ll know that 1000 row retrieval will satisfy the needs of your scenario. With care, you can increase this number to fit your scenario. As you increase this number, your app’s performance may degrade, especially for wide tables with lots of columns. Still, the best answer is to delegate as much as you can.
Understanding delegation warning with practical examples –
We will be understanding the delegation warning with the below given examples.
- Consider the use-case scenario as given in the below diagram.
- Below are the set of operations which will be perform using the Canvas App Power FX Formulas.
- Counting total number of “CRM Crate Account” related to the main “Subscriber” record.
- Summing the field “Payable Amount” present in the “CRM Crate Account” records which are related to the main “Subscriber” record.
- Display the complete list of “CRM Crate Account” records which are related to the main “Subscriber” record.
- I have purposefully utilize the “In” operation in the filtering formula to display the delegation warning as shown below.
- Delegation warning occurred while counting the total number of “CRM Crate Account” related to the main “Subscriber” record.
- Delegation warning occurred while summing the field “Payable Amount” present in the “CRM Crate Account” records which are related to the main “Subscriber” record.
- Delegation warning occurred while summing the displaying the complete list of “CRM Crate Account” records which are related to the main “Subscriber” record.
- Considering the demo data, there are total six “CRM Crate Account” records in the dataverse as shown below.
- Currently, the application’s row retrieval limit is 1000, therefore all the six “CRM Crate Account” records will get retrieved by the above given formulas (1000 > 6).
- Now for demonstration purpose, let us reduce the row retrieval limit to 2 from 1000. Now since the row retrieval limit (2) is less than the total rows present in the collection (6) (Dataverse Entity), only two rows will get retrieved by the above given formulas.
Thus, we learned and understood the delegation warning in the Canvas App with practical examples.