更改动态crm 2015中的子网格过滤器抛出错误

时间:2015-08-25 16:35:36

标签: crm dynamics-crm-2015 fetchxml

下午好。我试图改变一个数据网格时遇到了一个非常奇怪的问题,谷歌也没有运气。我使用下面的javascripts来设置一个名为" Opp_Prods"的子网格的获取和布局。

function timeOutReassignFilter()
{
console.log("About to setTimeout");
    setTimeout(SetProductView, 1000);
console.log("Set TimeOut");
}

function SetProductView()
{
try
{
var accountId = Xrm.Page.data.entity.getId();
var viewId = '{00000000-0000-0000-0000-000000000001}';
var entityName = "opportunityproduct";
var viewDisplayName = "Associated Opportunity Products View";

console.log("About to set fetchxml: " + accountId);
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" + 
  "<entity name='opportunityproduct'>" +
    "<attribute name='productid' />" +
    "<attribute name='productdescription' />" +
    "<attribute name='priceperunit' />" +
    "<attribute name='quantity' />" +
    "<attribute name='new_serialnumber' />" +
    "<attribute name='extendedamount' />" +
    "<attribute name='opportunityproductid' />" +
    "<order attribute='productid' descending='false' />" +
    "<link-entity name='opportunity' from='opportunityid' to='opportunityid' alias='ac'>" +
      "<filter type='and'>" +
        "<condition attribute='parentaccountid' operator='eq' value='" + accountId + "' />" + //uiname='Test Account' 
      "</filter>" +
    "</link-entity>" +
  "</entity>" +
"</fetch>";

console.log("About to set layoutXml");
var layoutXml = "<grid name='Opp_Prods' object='1' jump='productid' select='1' icon='1' preview='1'>" +
    "<row name='result' id='myproductid'>" +
        "<cell name='productdescription' width='150' />" +
        "<cell name='productid' width='150' />" +
        "<cell name='priceperunit' width='150' />" +
        "<cell name='quantity' width='150' />" +
        "<cell name='extendedamount' width='150' />" +
        "<cell name='new_serialnumber' width='150' />" +
        "<cell name='opportunityproductid' width='150' />" +
    "</row>" +
"</grid>";

console.log("About to set Control by adding custom view.");
//    Xrm.Page.getControl("opp_prods").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

document.getElementById("Opp_Prods").control.SetParameter("fetchXML", fetchXml);
document.getElementById("Opp_Prods").control.SetParameter("layoutXML", layoutXml);
Xrm.Page.ui.controls.get("Opp_Prods").refresh();
console.log("Custom View Added.");
}
catch(err)
{
console.log(err);
}
}

当表单加载时,它会抛出以下错误:

  

未处理的例外情况:   System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault,   Microsoft.Xrm.Sdk,Version = 7.0.0.0,Culture = neutral,   PublicKeyToken = 31bf3856ad364e35]]:System.Xml.XmlException:Microsoft   Dynamics CRM遇到了错误。参考编号   管理员或支持:#E63BFD86Detail:
  -2147220970 System.Xml.XmlException:Microsoft Dynamics CRM具有   遇到了错误。管理员或支持的参考编号:

     

E63BFD86 2015-08-25T16:13:21.2028543Z

<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic"
     

/&GT;       System.InvalidCastException:Microsoft Dynamics CRM遇到错误。管理员或支持的参考编号:

     

F2D68509

<Timestamp>2015-08-25T16:13:21.2028543Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />   </InnerFault>   <TraceText i:nil="true" /> </OrganizationServiceFault>

以下是我们的CRM跟踪日志中的完整跟踪:

  

[2015-08-25 11:24:37.314]流程:w3wp   |组织:f6d279c3-1548-e511-80bd-00155d001302 |主题:118   |类别:应用程序|用户:00000000-0000-0000-0000-000000000000   |等级:错误|要求:021d486e-5560-4f4e-a87a-a138ee9f8f3f |   ErrorInformation.LogError ilOffset = 0x17

     
    

MSCRM错误报告:     -------------------------------------------------- -------------------------------------------------- ----错误:System.InvalidCastException:无法转换类型的对象     &#39; System.DBNull&#39;输入&#39; Microsoft.Xrm.Sdk.OptionSetValue&#39;。在     Microsoft.Crm.Application.Controls.Grid.UI.PropertyTemplatePropertiesConfigurationColumn.BindData(WebControl的     parentControl,IRowDataSource rowData)at     System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at     System.Web.UI.Control.DataBindChildren()at     System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at     System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,Int32     dataSourceIndex,DataControlRowType rowType,DataControlRowState     rowState,Boolean dataBind,Object dataItem,DataControlField []     fields,TableRowCollection行,PagedDataSource pagedDataSource)
    在System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable     dataSource,Boolean dataBinding)at     System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable的     数据)     System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable的     数据)     System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable的     System.Web.UI.WebControls.DataBoundControl.PerformSelect()上的数据)     在     Microsoft.Crm.Application.Controls.Grid.UI.LayoutProviderGridList.RenderGridData(HtmlTextWriter的     输出)at     Microsoft.Crm.Application.Controls.Grid.UI.LayoutProvider.Render(HtmlTextWriter的     输出)at     Microsoft.Crm.Application.Controls.GridUIProvider.Render(HtmlTextWriter的     输出)at     Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.GetRefreshResponseHtml(IGridUIProvider     uiProvider,StringBuilder sbTemp)at     Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.Refresh(字符串     gridXml,StringBuilder sbXml,StringBuilder sbHtml,Boolean     returnJsonData)at     Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.ProcessRequestInternal(HttpContext的     上下文中)

  
     

错误消息:System.InvalidCastException:无法转换对象   键入&#39; System.DBNull&#39;输入&#39; Microsoft.Xrm.Sdk.OptionSetValue&#39;。在   Microsoft.Crm.Application.Controls.Grid.UI.PropertyTemplatePropertiesConfigurationColumn.BindData(WebControl的   parentControl,IRowDataSource rowData)at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.Control.DataBindChildren()at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,Int32   dataSourceIndex,DataControlRowType rowType,DataControlRowState   rowState,Boolean dataBind,Object dataItem,DataControlField []   fields,TableRowCollection行,PagedDataSource pagedDataSource)
  在System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable   dataSource,Boolean dataBinding)at   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable的   System.Web.UI.WebControls.DataBoundControl.PerformSelect()上的数据)   在   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProviderGridList.RenderGridData(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.GridUIProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.GetRefreshResponseHtml(IGridUIProvider   uiProvider,StringBuilder sbTemp)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.Refresh(字符串   gridXml,StringBuilder sbXml,StringBuilder sbHtml,Boolean   returnJsonData)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.ProcessRequestInternal(HttpContext的   上下文中)

     

源文件:不可用

     

行号:不可用

     

请求网址:   https://manufacturingdemo.crm2015.cloudappsonline.net/AppWebServices/AppGridWebService.ashx?operation=Refresh

     

堆栈跟踪信息:[InvalidCastException:无法转换类型的对象   &#39; System.DBNull&#39;键入&#39; Microsoft.Xrm.Sdk.OptionSetValue&#39;。] at   Microsoft.Crm.Application.Controls.Grid.UI.PropertyTemplatePropertiesConfigurationColumn.BindData(WebControl的   parentControl,IRowDataSource rowData)at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.Control.DataBindChildren()at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,Int32   dataSourceIndex,DataControlRowType rowType,DataControlRowState   rowState,Boolean dataBind,Object dataItem,DataControlField []   fields,TableRowCollection行,PagedDataSource pagedDataSource)
  在System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable   dataSource,Boolean dataBinding)at   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable的   System.Web.UI.WebControls.DataBoundControl.PerformSelect()上的数据)   在   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProviderGridList.RenderGridData(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.GridUIProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.GetRefreshResponseHtml(IGridUIProvider   uiProvider,StringBuilder sbTemp)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.Refresh(字符串   gridXml,StringBuilder sbXml,StringBuilder sbHtml,Boolean   returnJsonData)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.ProcessRequestInternal(HttpContext的   上下文中)

     

[XmlException:System.InvalidCastException:无法转换对象   键入&#39; System.DBNull&#39;输入&#39; Microsoft.Xrm.Sdk.OptionSetValue&#39;。在   Microsoft.Crm.Application.Controls.Grid.UI.PropertyTemplatePropertiesConfigurationColumn.BindData(WebControl的   parentControl,IRowDataSource rowData)at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.Control.DataBindChildren()at   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)at   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,Int32   dataSourceIndex,DataControlRowType rowType,DataControlRowState   rowState,Boolean dataBind,Object dataItem,DataControlField []   fields,TableRowCollection行,PagedDataSource pagedDataSource)
  在System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable   dataSource,Boolean dataBinding)at   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable的   数据)   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable的   System.Web.UI.WebControls.DataBoundControl.PerformSelect()上的数据)   在   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProviderGridList.RenderGridData(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.Grid.UI.LayoutProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Application.Controls.GridUIProvider.Render(HtmlTextWriter的   输出)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.GetRefreshResponseHtml(IGridUIProvider   uiProvider,StringBuilder sbTemp)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.Refresh(字符串   gridXml,StringBuilder sbXml,StringBuilder sbHtml,Boolean   returnJsonData)at   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.ProcessRequestInternal(HttpContext的   上下文)]   Microsoft.Crm.Core.Application.WebServices.AppGridWebServiceHandler.ProcessRequestInternal(HttpContext的   上下文)   System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,   布尔和放大器; completedSynchronously)

我完全感到困惑,并且帮助你们提供的人会非常感激。关于这一点最令人不安的是,我提取的所有字段都不是一个选项集,所以这里发生了什么?谢谢。

0 个答案:

没有答案