https://nishantrana.me/2017/05/21/filter-subgrid-in-dynamics-365-with-new-form-rendering-or-turbo-form/
function filterSubGrid()
{
// get the current record's guid
var entityId = Xrm.Page.data.entity.getId();
// refer the subgrid
var testGrid = window.parent.document.getElementById("Test");
if (testGrid == null)
{
setTimeout(function () {filterSubGrid(); }, 2000);
return;
}
// fetch xml code using User operator
var fetchXml = "<fetch distinct='false' no-lock='false' mapping='logical'>" +
"<entity name='new_test' >" +
"<attribute name='new_name' />" +
" <attribute name='new_testname' />" +
"<order attribute='new_name' descending='true' />" +
"<filter type='and'>" +
"<condition attribute='new_testid' operator='under' value='"+entityId+"'"+"/>" +
"</filter>" +
"</entity>" +
"</fetch>";
if (testGrid.control != null)
{
testGrid.control.SetParameter("fetchXml", fetchXml);
testGrid.control.refresh();
}
else
{
setTimeout(filterSubGrid, 500);
}
}
No comments:
Post a Comment