Notifications
Announcements
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?
Hello @aadil-gl,
Create a SubGrid and Select Lead Entity with Type as ALL RECORDS
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/UCnGNN3hdlKBOr6PXotskNLABlog : https://microsoftcrmtechie.blogspot.com
@rampprakash , thank you so much for this. Gonna try this out and let you know how it fares..
Thanks again!
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 717 Most Valuable Professional
Michael E. Gernaey 329 Super User 2025 Season 2
Power Platform 1919 268