Reputation: 159
I am trying to create a filtered sub grid in crm 2011. I found the following link which describe how to make it: http://community.dynamics.com/product/crm/f/117/p/76157/140281.aspx
This is how it is recommanded to build the code:
var relatedOHSOrders = document.getElementById("OHSOrderSubGrid_d"); //Set Subgrid Id
var fetchXml = "..."
relatedOHSOrders.control.setParameter("fetchXml", fetchXml);
The problem I have is I get Object does not support .setParameter property or method
and when I debbug it I do not see setParameter under relatedOHSOrders.control.
I Uninstalled and reinstalled rollup 11 just in case but still having the same issue!
Please note I tried other way to use setParameter. The below code also does not work
Xrm.Page.getControl("OHSOrderSubGrid")._control.get_innerControl();
relatedOHSOrders.setParameter("fetchXml", fetchXml);
It seems that everybody using this code to have filter subgrid but I am not sure what is my problem that it does not show up.
Thanks in advance for any help or suggestion.
Upvotes: 1
Views: 2457
Reputation: 1
Just replace the control.setParameter
with control.SetParameter
.
For more details please have a look at this MSDN article.
Upvotes: 0
Reputation: 31
As you could know the latest update rollup for Microsoft Dynamics CRM on-premises and service update for Microsoft Dynamics CRM Online includes significant changes in the web application in order to be able to support a variety of browsers. Have a look at this article: http://support.microsoft.com/kb/2795627
The script that you are trying to use was working in the previous RUP versions of CRM. The setParameter function is no longer available. Now you can use SetParameter instead of it. Fortunately refresh function is still available. So change the function name in your code and it will work.
Upvotes: 3
Reputation: 159
I found the answer to my question myself. The below code perfectly works
function setOhsOrderGrid()
{
var relatedOrders = document.getElementById("OrderSubGrid"); //Set Subgrid Id
//If this method is called from the form OnLoad, make sure that the grid is loaded before proceeding
if (relatedOrders == null || relatedOrders.readyState != "complete") {
//The subgrid hasn't loaded, wait 1 second and then try again
setTimeout('setOhsOrderGrid()', 1000);
return;
}
var fetchXml = "<?xml version='1.0'?>";
fetchXml += "<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>";
fetchXml += "<entity name='new_ohsorder'> <attribute name='new_orderid'/>";
fetchXml += "<attribute name='new_order_no'/>";
fetchXml += "<attribute name='createdon'/>";
fetchXml += "<order descending='false' attribute='new_order_no'/>";
fetchXml += "<filter type='and'> <condition attribute='new_clientcontactid' value='{1E9A621B-ACA1-E011-9A67-005056A8002D}' uitype='new_clientcontact' uiname='OHS-000001-6FBC4-CCR-01' operator='eq'/>";
fetchXml += "</filter>";
fetchXml += "</entity>";
fetchXml += " </fetch>";
relatedOrders.control.setParameter("fetchXml", fetchXml); --> It breaks
relatedOrders.control.refresh(); --> It breaks
};
setOhsOrderGrid();
I had to change var relatedOrders = document.getElementById("OrderSubGrid_d") to var relatedOrders = document.getElementById("OrderSubGrid")
I got a comment that setParameter is unsupported. I don't know why and how I could know that. because setParameter document.getElementById("OrderSubGrid").control.setParameter !!! Does anybody have any idea? And I wonder if anybody know how to code a filter subgrid in a supported way!??
Upvotes: 2