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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show related records w...
Power Apps
Unanswered

Show related records where address is the same on lead record

(0) ShareShare
ReportReport
Posted on by

Hi Friends,

I am using Dynamics 365 and have multiple lead records and addresses. There are some leads that share an address (where people stay together).

 

When we open a lead, we want to show the a list of all the other records that share the same address. Is this possible? how can it be done?

I have the same question (0)
  • Verified answer
    Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @aadil-gl,

     

    Create a SubGrid and Select Lead Entity with Type as ALL RECORDS

     

    rampprakash_0-1641820372996.png

     

     

    Make Sure You are UnSelecting(Show Related Records) and Table as Lead and View as (Active View)

     

    Then Write below JS

     

     

    function filterSubGrid(executionContext){
    var formContext = executionContext.getFormContext();
    var fetchxml = "<filter type='and'>" +
    "<condition attribute='LINE1LOGICALNAME' operator='eq' value='" + formContext.getAttribute("LINE1VALUE").getValue()+ "' />" +
    "<condition attribute='LINE2LOGICALNAME' operator='eq' value='" + formContext.getAttribute("LINE2VALUE").getValue()+ "' />" +
    "</filter>";
    var subgrid = formContext.getControl("YOURSUBGRIDNAME");
    subgrid.setFilterXml(fetchxml);
    subgrid.refresh();
    }

     

     

    Please find my video for How to Write JS : https://www.youtube.com/watch?v=x8kYNCkikgs&t=14s

     

    Call the above function onLoad of Page 🙂

     

    That's it.

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • aadilg Profile Picture
    on at

    @rampprakash , thank you so much for this. Gonna try this out and let you know how it fares..

     

    Thanks again!

  • AnandM Profile Picture
    41 on at

    Hi @rampprakash , 

    Can we use this undocumented method setfilterxml in our implementations? 

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard