Get Rid of Delegation Warnings in Formulas
Lose those annoying warnings and increase your app's performance & accuracy
Delegate (verb) - entrust (a task or responsibility) to another person, typically one who is less senior than oneself.
While the Oxford Dictionary gives this word a positive spin (I’m entrusting you with this…) it really depends on which side of the delegation equation you’re on, doesn’t it? Typically, delegation it isn’t something we enjoy when it happens to us, but it isn’t all bad and it definitely can help you be more productive if you are able to trust others and delegate things yourself.
And when it comes to Power Apps, delegation is definitely your friend, which is why you should always be on the lookout for any delegation warnings you see in Power App Studio while building your app. These warnings are telling you that your friend may not be able to help you like you want, and you should definitely look into it and fix it, so those warnings disappear.
Delegation in Power Apps
There are lots of good resources out there for what delegation is, where it comes into play, etc. So rather than do a deep dive into here I will just give a quick summary and some resources for further reading.
In a lot of cases, the filtering or looking up of one or a small subset of many records is done by Power Apps, through functions like Filter, Sort, and LookUp, and this action happens on the client side of things – so in the browser window or in the Power Apps app on mobile. Both of these contexts however have limited processing power, memory, and of course network bandwidth. But when it comes to large data sets where row counts exceed 500, Power Apps (and PowerFx) was designed to delegate, or hand off, this processing to the data source server. This is why delegation is a good thing for the app maker and users, it is there to speed up your app’s performance when working with large data sets.
TIP - you can increase the default data row limit for non-delegable data sources on a per app basis from the default of 500 up to 2,000 by going to App Settings > General > Data row limit.
Now there are limitations to this ability to delegate the processing, not all functions support it, for example Filter, Search, and LookUp _do_ support it but If, Concatenate, and ClearCollect _do not_. And there are also data source limitations on top of that, so tabular data sources like Dataverse, SharePoint, SQL Server, and Salesforce support delegation but others may not; and unfortunately, I haven’t been able to find a comprehensive list of which ones do and don’t.
For more information on this topic, I highly recommend Joy Kirkwood’s appropriately named post A Deep Dive Into Delegation1.
And of course, the Microsoft Learn documentation2 is a good resource also.
What do delegation warnings look like?
These warnings only show in the maker portal (so not for end users) and will show up as yellow triangles in the canvas authoring portion of the screen and as dreaded blue highlighting in the formula bar.
They’re just warnings, not errors, right?
This is true, they aren’t things that will stop your app from working technically but it is important not to just dismiss these warnings. If you are 100% positive the data in question will never exceed 500-2000 rows then it may be okay to let the warning be. But don’t forget that things tend to grow over time, beyond original scopes and plans, so I consider it a Power Apps best practice to never leave delegation warnings. I always address them to prevent possible future issues.
And, as Joy points out in her article, if you ignore the warnings, you have no control over what data gets returned from the data source for large data sets:
“When your query isn’t delegated to the server, there’s no way to control what is sent back to the client. …the reality is that you could get back any random data set! It could be the first 2000 records created, or the most recent 2000 records. Each data source might handle the request differently.”
Get Rid of Delegation Warnings in PowerFx Formulas
All this is great, but how do you get rid of those yellow triangles and blue underlines?
Basically, you have to get creative. You might be able to utilize a global or contextual variable in your formula to get around the warning, or maybe a different combination of functions in your formula. Or if your data source allows it, you could also create views that pre-filter your data to a subset less than 2,000 rows and then reference that view as your data source when loading records.
That said, one of my favorite tools in this scenario is to use the With function. I’ve written an overview about this function you can find here3 and in my next post I’ll give you an example4 of how I used it recently with a SQL data source when doing nested LookUps that were giving delegation warnings.
That’s it for today, thanks for reading!