CRM 2011-control.SetParameter一直未定义

时间:2015-06-08 12:02:12

标签: javascript dynamics-crm-2011 dynamics-crm

我有一个javascript函数,它检索自定义实体表单上的查阅字段的信息,并在同一表单上过滤子网格视图。查找字段是" new_region"子网格字段是" Open_Opportunities"。我目前有脚本在窗体上运行为OnLoad事件。每当我尝试运行表单时,都会收到以下消息:

"要使用此保存的视图,您必须删除引用已删除或不可搜索项目的条件和列。"

这是我的剧本:



function updateSubGrid() {

var relatedOpportunities = document.getElementById('Open_Opportunities'); 

var lookupField = new Array;
 
lookupField = Xrm.Page.getAttribute('new_region').getValue(); 

if(lookupField != null) {
var lookupid = lookupField[0].id; 
}
else {
return;
}


if (relatedOpportunities == null || relatedOpportunities.readyState !='complete' ){
setTimeout('updateSubGrid()', 4000); 
return;
} 


var fetchXml = "<fetch distinct = 'false' mapping = 'logical' output-format='xml-platform' version='1.0'>"+
                         "<entity name = 'opportunity'>"+
                         "<attribute name = 'name'/>"+
                         "<attribute name = 'customerid'/>"+
                         "<attribute name = 'cs_awarddate'/>"+
                         "<attribute name = 'cs_inforcast'/>"+
                         "<attribute name = 'cs_overallprobability'/>"+
                         "<attribute name = 'cs_opportunitystage'/>"+
                         "<attribute name = 'cs_marketid'/>"+
                         "<attribute name = 'cs_estimatedrevenuemillions'/>"+
                         "<attribute name = 'ownerid'/>"+
                         "<attribute name = 'opportunityid'/>"+
                         "<link-entity name = 'new_salesplan' from='new_region' to='cs_marketid' alias='aa' link-type='outer'>"+ 
                         "<filter type = 'and'>"+
                        "<filter type = 'and'>"+
                         "<filter type = 'and'>"+
                         "<condition attribute ='statecode' value='0' operator='eq'/>"+
                         "<condition attribute ='ownerid' operator='eq-userid'/>"+ 
                         "<condition attribute = 'cs_marketid' operator='eq' uitype='opportunity' value='"+ lookupid + "'/>"+
                         "</filter>"+
                         "</filter>"+
                         "</filter>"+
                         "</link-entity>"+
                         "</entity>"+ 
                         "</fetch>"; 


relatedOpportunities.control.SetParameter("fetchXml", fetchXml); 
relatedOpportunities.control.refresh();


}​
&#13;
&#13;
&#13;

使用F12调试器后,我发现了以下行:

relatedOpportunities.control.SetParameter(&#34; fetchXml&#34;,fetchXml);

连续返回未定义。我的fetchXml是使用高级查找构建的,当我检查我的fetchXml变量时,它肯定不是null或未定义。我也尝试将其作为OnSave事件运行,并收到相同的消息。此外,错误文件提供了错误消息&#34;服务器无法处理请求。&#34;有谁知道为什么会这样?

(顺便说一下,我正在进行最新的汇总更新)

0 个答案:

没有答案