web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CDS Contacts search wi...
Power Apps
Answered

CDS Contacts search with Lookup : Delegation issue

(0) ShareShare
ReportReport
Posted on by 113 Most Valuable Professional

Hi Community,

 

I'm trying to implement a CDS Contacts search feature and I'm fighting with delegation issue. The app should be able to search for contacts (easy), accounts (easy) AND contacts related to found accounts (this is where the issue stands).

 

Here is the formula I have so far:

If(!IsBlank(Trim(TextSearchBox1.Text)); 
Concurrent(
ClearCollect(ContactsFound;Filter(Contacts; Trim(TextSearchBox1.Text) in 'Full Name' ));
ClearCollect(AccountsFound;Filter(Accounts; Trim(TextSearchBox1.Text) in 'Account Name').Account)
);;
Collect(ContactsFound;Filter(Contacts; AsType('Company Name';[@Accounts]).Account in AccountsFound))
;Blank())

 

The last Collect is where delegation warning is reported.

 

I cannot find a way to avoid PowerApps to download all contacts to evaluate the Filter. Is there a way to do this? It seems there is no way to delegate a search against CDS Lookup field type...

 

Anyone would have a magical trick for me?

 

Categories:
I have the same question (0)
  • Joel CustomerEffective Profile Picture
    3,224 on at

    See this post from @PowerAddict  https://powerusers.microsoft.com/t5/Building-Power-Apps/CDS-Contacts-search-with-Lookup-Delegation-issue/m-p/617512

     

    One thing that can make delegatable functions non delegatable is if. 

     

  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at

    @jlindstrom the link your gave is the link of this current thread. Can you give the appropriate link?

     

    Thanks

  • Joel CustomerEffective Profile Picture
    3,224 on at
  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at

    Thank you @jlindstrom  but I don't think it fits my problem.

     

    What I'm after is to understand how to filter contacts based on parentcustomerid with multiple accounts unique identifier in a delegated way.

     

    In the end, I would like the query performed to be something like the following if I retrieved 3 accounts $filter=_parentcustomerid_value eq xxxx or _parentcustomerid_value eq yyyy or _parentcustomerid_value eq zzz

  • Joel CustomerEffective Profile Picture
    3,224 on at

    Ok, i misread your original query.  I think the delegation issue is with in. I've had to do this one time before and I can't find the example, but I think it was something like what is in this post: https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-filter-data-based-on-a-collection-in-powerapps/td-p/313750

     

     

    Collect(anotherCollection, Lookup(CustomerList, Customer_ID = Result))
  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at

    I tried the ForAll approach but the delegation warning is just moved from "=" to "AsType" code

     

    If(!IsBlank(Trim(TextSearchBox1.Text)); 
    Concurrent(
    ClearCollect(ContactsFound;Filter(Contacts; Trim(TextSearchBox1.Text) in 'Full Name' ));
    ClearCollect(AccountsFound;Filter(Accounts; Trim(TextSearchBox1.Text) in 'Account Name').Account)
    );;
    ForAll(AccountsFound;
    Collect(ContactsFound;Filter(Contacts; AsType('Company Name';[@Accounts]).Account = Account))
    )
    ;Blank())
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @TanguyT ,

     

    'Company Name' is polymorphic lookups  field, and the AsType() function is not delegable in Filter formula.

    If you change to use a common LookUp field, then the ForAll() formula will work properly without any delegation warnning.

    Snipaste_2020-07-08_14-46-07.png

    Hope this helps.

    Sik

     

  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at

    Thank you that helps to understand but not to resolve the issue. I have to use parentcustomerid customer field. 

     

    But I got the point and will see if I can duplicate the info in a dedicated lookup field

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 408

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 319

Last 30 days Overall leaderboard