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 Pages / Custom Lookup filter
Power Pages
Answered

Custom Lookup filter

(0) ShareShare
ReportReport
Posted on by 312

Hi community, I have a search field in the form, and the filter I want to do here is hide certain records if the contact is not associated with a customer nameHere is the data without filters through advanced search:

 

MartinVargas_2-1635540078078.png

This is my JavaScript code

//Cliente: '{{user.cr6e3_cliente}}' -> 2-212

$(document).ready(function () {
 
 var list = $("#cr6e3_mkt_elementoslistaprecios_lookupmodal").find(".entity-lookup").find(".entity-grid").eq(0);
 list.on("loaded", function () {
 
 var cliente = "{{user.cr6e3_cliente}}";
 console.log("Tipo de cliente: " + cliente);

 var primaryColumn = $("#cr6e3_cliente");

 if (primaryColumn == cliente) {
 list.find("table tbody > tr").each(function () {
 var tr = $(this);
 var others = $(tr).find('td[data-attribute="cr6e3_cliente"]').attr("data-value");
 if (others != cliente ) {
 tr.remove();
 }
 });
 }
 });
}); 

This is what I hope will come out, from the associated client, in this case the client password is 2-212.

 

MartinVargas_0-1635539982877.png

 

Can anybody help me out here ?

Cheers folks. 

Categories:
  • Verified answer
    MartinVargas Profile Picture
    312 on at

    Guys, it was just to match in the if the "cliente".

     

    if (cliente == cliente) {
     list.find("table tbody > tr").each(function () {
     var tr = $(this);
     var others = $(tr).find('td[data-attribute="cr6e3_cliente"]').attr("data-value");
     if (others != cliente ) {
     tr.remove();
     }
     });
     }
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @MartinVargas :

    Thanks for your feedback and glad to hear that you have solved this problem.

    Best Regards,

    Bof

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
M Bilal Khan Profile Picture

M Bilal Khan 139

#2
Mohsin Ali Profile Picture

Mohsin Ali 41

#3
11manish Profile Picture

11manish 21 Super User 2026 Season 2

Last 30 days Overall leaderboard