Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

filter subgrids crm 2011 - 'setParameter': object is null or undefined

$
0
0

I am trying to filter subgrids based on a lookup field on the form. Could anyone explain why i get this error message:

Any advices is welcomed

Thank you.

The code:

function updateSubGrid() { //This will get the related products grid details and store in a variable. var related = Xrm.Page.ui.controls.get("AssociatedActivities") ;

//Initializing the lookup field to store in an array. var lookupfield = new Array; //Get the lookup field lookupfield = Xrm.Page.getAttribute("regardingobjectid").getValue(); //This will get the lookup field guid if there is value present in the lookup if (lookupfield != null) { var lookupid = lookupfield[0].id; } //Else the function will return and no code will be executed. else { return; } //This method is to ensure that grid is loaded before processing. if (related ==null || related.readyState != "complete") { //This statement is used to wait for 2 seconds and recall the function until the grid is loaded. setTimeout("updateSubGrid()", 2000); return; } //This is the fetch xml code which will retrieve all the order products related to the order selected for the case. var fetchXml = "<fetch version=’1.0' output-format=’xml-platform’ mapping=’logical’ distinct=’false’>"; fetchXml += "<entity name=’activitypointer’>"; fetchXml += "<attribute name=’subject’/> "; fetchXml += "<attribute name= ’statecode’/>"; fetchXml += "<attribute name=’prioritycode’/>"; fetchXml += "<attribute name= ’modifiedon’/>"; fetchXml += "<attribute name= ’activityid’/>"; fetchXml += "<attribute name= ’instancetypecode’/>"; fetchXml += "<order attribute=’modifiedon’ descending=’false’ />"; //fetchXml += "<link-entity name=’’ from=’’ to=’’ alias=’aa’>"; fetchXml += "<filter type=’and’>"; fetchXml +="<filter type='or'>"; fetchXml += "<condition attribute=’statecode’ value=’” + lookupid + “‘ operator='eq'/>"; fetchXml += "<condition attribute=’statecode’ value='1' operator='eq'/>"; //fetchXml += “<condition attribute=’salesorderid’ operator=’eq’ uiname=’Order Name’ uitype=’salesorder’ value=’” + lookupid + “‘ />”; fetchXml += "</filter>"; fetchXml += "</link-entity>"; fetchXml += "</entity>"; fetchXml += "</fetch>"; //Setting the fetch xml to the sub grid. related.control.setParameter("fetchXml", fetchXml); //This statement will refresh the sub grid after making all modifications. related.control.refresh(); }





Viewing all articles
Browse latest Browse all 10280

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>