Hi,
I have below code which is stopped working after the CRM updated to 7.1 from 7.0.
///// **********Code :****************/////
function setKBArticleSubGrid() {
var ConnectionSubgrid = Xrm.Page.getControl("relatedKBArticles").getGrid();
if (ConnectionSubgrid == null) {
setTimeout(function () { setKBArticleSubGrid(); }, 2000); //if the grid hasn’t loaded run this again
return;
}
if (Xrm.Page.getAttribute("sp_bu").getValue() != null && Xrm.Page.getAttribute("sp_category").getValue() != null && Xrm.Page.getAttribute("sp_subcategory").getValue() != null
&& Xrm.Page.getAttribute("sp_subsubcategory").getValue() != null) {
var buID = Xrm.Page.getAttribute("sp_bu").getValue()[0].id.replace('{', '').replace('}', '');
var categoryId = Xrm.Page.getAttribute("sp_category").getValue()[0].id.replace('{', '').replace('}', '');
var subCategoryId = Xrm.Page.getAttribute("sp_subcategory").getValue()[0].id.replace('{', '').replace('}', '');
var subSubCategoryId = Xrm.Page.getAttribute("sp_subsubcategory").getValue()[0].id.replace('{', '').replace('}', '');
var FetchXml = "<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>" +
"<entity name='kbarticle' >" +
"<attribute name='subjectid'/>" +
"<order descending='false' attribute='subjectid'/>" +
"<filter type='and'>" +
"<condition attribute='statecode' value='3' operator='eq'/>" +
"<condition attribute='sp_bu' value='" + buID + "' operator='eq'/>" +
"<condition attribute='sp_category' value='" + categoryId + "' operator='eq'/>" +
"<condition attribute='sp_subcategory' value='" + subCategoryId + "' operator='eq'/>" +
"<condition attribute='sp_subsubcategory' value='" + subSubCategoryId + "' operator='eq'/>" +
"</filter>" +
"</entity>" +
"</fetch>";
if (ConnectionSubgrid != null)
{
ConnectionSubgrid.SetParameter("fetchXml", FetchXml); //set the fetch xml to the sub grid
ConnectionSubgrid.Refresh(); //refresh the sub grid using the new fetch xml
}
else
{
alert("control is null");
}
//ConnectionSubgrid.control.SetParameter("fetchXml", FetchXml); //set the fetch xml to the sub grid
//ConnectionSubgrid.control.Refresh(); //refresh the sub grid using the new fetch xml
}
}
////////////////////////////////////////////////
In CRM 2015online update 1 new method has been introduced getGrid() which I have used in above code.
Now I ma getting the error while setting the custom fetchxml to the subgrid. Anyone has any idea that SetParameter() is also depreciated. If yes which is the new method. Is there any alternate way I can set the custom fetchxml to subgrid.
Below is the error I am getting:
ERROR:
TypeError: Object doesn't support property or method 'SetParameter'
at setKBArticleSubGrid (ccrmuat.crm5.dynamics.com/.../sp_CaseFormJs)
at eval code (eval code:1:1)
at RunHandlerInternal (ccrmuat.crm5.dynamics.com/.../ClientApiWrapper.aspx:144:1)
at RunHandlers (ccrmuat.crm5.dynamics.com/.../ClientApiWrapper.aspx:103:1)
at OnScriptTagLoaded (ccrmuat.crm5.dynamics.com/.../ClientApiWrapper.aspx:217:1)
at Anonymous function (ccrmuat.crm5.dynamics.com/.../ClientApiWrapper.aspx:188:1)
Any help on this would be highly appreciated
Thanks and Regards,
DIlip