Hi,
In one of the projects which was recently upgraded to CRM 2016 Online Update 1, legacy form rendering was being used. So, we were analyzing how the new form rendering will affect the existing JavaScript.
One of the unsupported JavaScript that was being used was for sub-grid filtering.
The interesting thing was that it works in CRM 2016 Online Update 1 for legacy form rendering but fails in case of new form rendering (turbo form).
For turbo forms, we get the following objects as null
I couldn’t find any workaround of implementing the same in case of turbo forms. The only possible solution that I could think of is either using Quick View Form with Subgrid control inside it or through a html web resource.
Hope it helps..
please try “parent.document…”
LikeLike
Thanks for you suggestion. Yes Parent works we get the subgrid object. It then fails in SetParameter
LikeLike
what about :
var ContactsIFollow = {
entityType: 1039, // SavedQuery
id:”{3A282DA1-5D90-E011-95AE-00155D9CFA02}”,
name: “Contacts I Follow”
}
//Set the view using ContactsIFollow
Xrm.Page.getControl(“Contacts”).getViewSelector().setCurrentView(ContactsIFollow);
LikeLiked by 1 person
Thanks Shai for your suggestions. In this case it won’t filter it. It will show a particular view as default.
LikeLike
Hi Nishant, Have you found any alternative for SetParameter. It fails for me as well. Thanks
LikeLike
Hii. I use folowing code for CRM2016 with turbo forms.
var budget_resources = parent.document.getElementById(“budget_resources”);
if (budget_resources == null || budget_resources.control == null) {
setTimeout(function () { THE_FUNCTION_NAME(); }, 500); //if the grid hasn’t loaded run this again
return;
}
var fetchXml = “<fetch version='1.0'…..
budget_resources.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
budget_resources.control.Refresh(); //refresh the sub grid using the new fetch xml
LikeLike
Thanks Michael let me try that.
LikeLike
where to add this function at load ?? i tried to add it on load but filtering not applied
LikeLike
This will not work for mobile application for sure.
I have used this it works well with online application but not on mobile.
LikeLiked by 1 person
We need to use window.parent.document.getElementById to read GridName
Wait for the control to load in the DOM before Setting to control
//fetch xml code
var fetchXml = “”;
if (Grid.control != null)
{
Grid.control.SetParameter(“fetchXml”, fetchXml); //set the fetch xml to the sub grid
Grid.control.refresh(); //refresh the sub grid using the new fetch xml
}
else
{
setTimeout(filterSubGridFunction, 500);
}
LikeLike
Thanks Prashant for sharing the info. Is it new form rendering enabled environment ?
LikeLike
Hi Nishant,
recently I and one of colleague were working on the filtered Subgrid view for the new UCI forms and finally we were able to achieve this functionality in a supported way using retrieve multiple Plugin and Paging issue also got resolved there. Please find my blog link for the whole solution.
https://sank8sinha.wordpress.com/2020/01/07/adding-filtered-views-in-uci-in-dynamics-365-crm-finally-achieved/
LikeLiked by 1 person
Great thanks for sharing the link
LikeLike
Please like and follow my blog.
LikeLike