Filtered sub grid is very commonly used feature in CRM 2011.
As you may already know we can use CRM default feature to
filter sub grid data by selecting different views for sub grid. But you may
come across situations where system needs to filter sub grid data based on opening
record field,
For example you need to filter Contact sub grid based on
Account form City field. So sub grid should only Contacts which have same city as
Account City:
In this kind of scenario we can use javascript to add
filter to the sub grid.
Use advance find and generate fetch xml for filter contact
function setContactSubGrid() { var grid = $('#accountContactsGrid')[0]; var accountCity = Xrm.Page.getAttribute("address1_city").getValue(); if (grid == null || grid.readyState != "complete") { setTimeout('setContactSubGrid()', 2000); } else { var fetchXml = "Call this function on Account onLoad event." + " "; grid.control.setParameter("fetchXml", fetchXml); grid.control.refresh(); } }" + " " + "" + " " + " " + " " + " " + " " + "" + "
No comments:
Post a Comment