Embedded Canvas Apps

Challenge #9: The Invisible Delegation issue

Challenge #9

Continuing with the example from the previous post, there are two ways the AddColumns function can be written. One leads to a delegation issue which is apparent as there is no associated delegation warning (here is a detailed post on this topic). For this example, I have changed the non-delegation limit to 1, so if we only see one related contact, we know we are running into delegation issues.

Changing the non-delegation limit to 1

This is the formula that leads to delegation issues.

SortByColumns(Search(AddColumns(Filter(Contacts, 'Company Name' = [@ModelDrivenFormIntegration].Item), "CreatedByName",'Created By'.'Full Name') , TextSearchBox1.Text, "CreatedByName"), "fullname", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

Delegation issues

Trick #9

Instead of using filter to get the list of related records, using the ModelDrivenFormIntegration control to directly get the related records doesn't lead to delegation issues. This is the revised formula that doesn't run into delegation issues.

SortByColumns(Search(AddColumns([@ModelDrivenFormIntegration].Item.Contacts , "CreatedByName",'Created By'.'Full Name') , TextSearchBox1.Text, "CreatedByName"), "fullname", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

The gallery then displays both related contacts even though the non-delegation limit is set to 1.

No delegation issues

Have fun! Get addicted!

Leave a Reply