Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Avoiding Delegation Warnings in PowerApps

Post Author: Joe D365 |

Delegation is a very important concept to understand, especially if you are working with large sets of data in PowerApps. For example, when performing operations, like filtering or searching for specific records in PowerApps, delegation offloads the work to the data source. What that really means is that operations like Search, Filter, and Lookup are performed at the data source instead of bringing the whole set of data to the device and then processing it locally. In essence, delegation is much more powerful method, as it processes data faster and improves performance of the app. Delegable sources are Dynamics 365 (CRM), Common Data Service for Apps, SharePoint, and SQL Server. In today’s blogpost, we’ll discuss common delegation warnings and how to avoid them.

Note that, generally speaking, delegation does not apply to data sets with less than 500 records, as those can be processed on the device without issue. While this “limit” can be changed, doing so may sacrifice performance.

Reasons for Delegation Warning

If you get a delegation warning while performing operations in your formulas, it means that one or more of the operations being performed cannot be offloaded to the other server for one of several reasons:

  • You may be using a function that is not (yet) supported by the data source in question. A detailed list of supported operations can be found here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview
  • With respect to the filter function, you may not be using constant values in an expression (see Examples of Scenarios that Will Throw a Delegation Warning below).
    • What this means is that the expression contains a value that will be DIFFERENT depending on the value of a certain column in the data set.
    • When a value in a filter expression depends on a column in the dataset that is being filtered, the value is not known at the time of retrieval and therefore the processing cannot be offloaded to the data source. (The data source cannot perform the calculations – it is only capable of evaluating the set number of expressions described here.)

Examples of Scenarios that Will Throw Delegation Warning

Example #1 – The following filter throws a delegation warning:

Filter(Jobs, 'Tentative Job Start Date' <= DateAdd(Today(),7, Days) )

Issue: DateAdd is not a constant value. The filter depends on the value of this expression, but the expression is not delegable to the data source (not in the list of supported operations). As a result, the entire filter operation cannot be delegated.

Solution: Evaluate the DateAdd expression separately and store the value in a variable (DateLimit) to be used in the Filter function. DateLimit is a constant value at the time of filtering. The filter no longer throws a delegation warning.

Set(DateLimit, DateAdd(Today(),7, Days));

Filter(Jobs, 'Tentative Job Start Date' <= DateLimit )

Example #2 – The following filter throws a delegation warning:

Filter(Jobs, 'Project Manager' = LookUp(Users, domainname = User().Email, systemuserid))

Issue: LookUp is not a constant value The filter depends on the value of this expression, but the expression is not delegable to the data source (not in the list of supported operations). As a result, the entire filter operation cannot be delegated.

Solution: Evaluate the LookUp expression separately and store the value in a variable (UserGuid) to be used in the Filter function. UserGuid is a constant value at the time of filtering. The filter no longer throws a delegation warning.

Set(UserGuid, LookUp( Users, domainname = User().Email , systemuserid) );

Filter(Jobs, 'Project Manager' = UserGuid )

Avoiding Delegation Warnings

As you can see from the examples above, using only constant values in your filter expressions, separating other independent calculations, and storing the result in a variable will eliminate delegation warnings. It is also helpful to use only expressions that are supported, as described in the linked article above.

Happy PowerApps’ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends