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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add pre-search filter ...
Power Apps
Unanswered

Add pre-search filter to a lookup column in a grid

(0) ShareShare
ReportReport
Posted on by 8

I am currently struggling with a pre-search filter that should be applied to a "Crossing Group" lookup, so the lookup should only displays those 3 Crossing Groups that are added to the grid (marked with green).

OsmanEsen_1-1662028657774.png

I am trying to use the addCustomFilter method, but this cannot be applied to an "attribute" but only to a "control". Are there any ways to add a pre-search filter in a grid column ?. 

My code:


var gridContextRoyaltyTemplate = formContext.getControl("nf_royalty_template_grid");
var royaltyGridRows = gridContextRoyaltyTemplate.getGrid().getRows();
    royaltyGridRows.forEach(function (row, i) {
        var rowEntity  = row.data.entity;
        var crControl = rowEntity.attributes.getByName("nf_crossing_group").getControl("nf_crossing_group");
        var nameValue = crControl.getValue();
        var fetchQuery = "<filter type='and'>" +
        "<condition attribute='nf_contract_rights_in' operator='eq' value='" + contractId + "' />" +
    "</filter>";
       
        crControl.addCustomFilter(fetchQuery);
      });




 

 

 

I have the same question (0)
  • Verified answer
    Mira Ghaly Profile Picture
    11,413 Moderator on at
    Re: Add pre-search filter to a lookup column in a grid

    @OsmanEsen 

    I am afraid this might not be possible using the PreSearch filter , as per the documentation it is available for formContext not gridContext

    https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/controls/addcustomfilter

     

    The alternative way would be to do it using a custom PCF control.

  • Osman Esen Profile Picture
    8 on at
    Re: Add pre-search filter to a lookup column in a grid

    Thanks for the reply

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard