javascript 在 MetadataCache 中找不到名称为 <entityName> 的实体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17033694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 06:50:59  来源:igfitidea点击:

The entity with name <entityName> was not found in the MetadataCache

javascriptdynamics-crm-2011dynamics-crm

提问by SHeinema

Following a Microsoft hands-on lab for Dynamics CRM 2011, I am attempting to add a custom view to a form that responds 'onchange' to a particular property. Here is my function to add the custom view:

遵循 Microsoft Dynamics CRM 2011 动手实验,我尝试将自定义视图添加到响应“onchange”特定属性的表单。这是我添加自定义视图的函数:

function HandleOnChangeDVMInformationLookup()
{
var locAttr = Xrm.Page.data.entity.attributes.get("new_referringdvm");

if (locAttr.getValue() != null)
{
    var dvmId = locAttr.getValue()[0].id;

    var viewDisplayName = "DVM Information";
    var viewIsDefault = true;

    var fetchXml  = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="dvminformation"><attribute name="dvminformation_id"/><attribute name="dvminformation_name"/><attribute name="new_firstname"/><attribute name="new_lastname"/><filter type="and"><condition attribute="id" operator="eq"  value="' +dvmId +'"/></filter></entity></fetch>';

    var layoutXml = '<grid name="resultset" object="10001" jump="dvminformation_name" select="1" icon="1" preview="1"><row name="result" id="dvminformation_id"><cell name="dvminformation_name" width="300" /><cell name="new_firstname" width="125"/></row></grid>';

    var control = Xrm.Page.ui.controls.get("new_dvm_information");
    control.addCustomView("62e0ee43-ad05-407e-9b0b-bf1f821c710e", "dvminformation", viewDisplayName, fetchXml, layoutXml, viewIsDefault );
}
}

Upon changing the selected 'dvm' in the form and triggering this function I receive the following error:

在更改表单中选定的“dvm”并触发此功能后,我收到以下错误:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The entity with a name = 'dvminformation' was not found in the MetadataCache.Detail: -2147217150 The entity with a name = 'dvminformation' was not found in the MetadataCache. 2013-06-10T22:01:49.4392114Z

未处理的异常: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: 实体名称 = 'dvminformation '未在 MetadataCache.Detail 中找到:-2147217150 在 MetadataCache 中未找到名称为 'dvminformation' 的实体。2013-06-10T22:01:49.4392114Z

Is 'dvminformation' not the entity name I just defined in the XML? Am I missing a step?

'dvminformation' 不是我刚刚在 XML 中定义的实体名称吗?我错过了一步吗?

Thanks.

谢谢。

采纳答案by James Wood

It's unlikely that dvminformationis a real entity name. Are you sure there is an entity that exists with that name?

这不太可能dvminformation是真实的实体名称。您确定存在具有该名称的实体吗?

Open the solution and look for the entity, then check its schema name.

打开解决方案并查找实体,然后检查其架构名称。

If its a custom entity they usually have the format of prefix_name, e.g. new_timeline, new_alert, in your case it might just be dvm_information. If dvmis your solution prefix.

如果它的自定义实体,他们通常的格式prefix_name,例如new_timelinenew_alert在你的情况很可能就是dvm_information。如果dvm是您的解决方案前缀。

Only system entity have a name without an underscore, e.g. contact, account, incidentand dvminformationdoesn't look like a system entity to me.

只有系统实体的名称不带下划线,例如contact, accountincident并且dvminformation在我看来不像系统实体。

回答by Georg Patscheider

I had the same error message with the customerAddress entity. Turns out I referenced the entity as "customerAddress"(note the camel case).

我有与 customerAddress 实体相同的错误消息。结果我将实体引用为"customerAddress"(注意骆驼案例)。

But CRM wants logical names of entities and attributes in all lower case. So "customeraddress"did work.

但是 CRM 需要所有小写的实体和属性的逻辑名称。所以,"customeraddress"没有工作。

回答by SarjanWebDev

Check if you are connecting to correct org (web.config?) See

检查您是否连接到正确的组织(web.config?) 请参阅