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:
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:
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
Is 'dvminformation' not the entity name I just defined in the XML? Am I missing a step?
Thanks.
It's unlikely that dvminformation
is a real entity name. Are you sure there is an entity that exists with that name?
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 dvm
is your solution prefix.
Only system entity have a name without an underscore, e.g. contact
, account
, incident
and dvminformation
doesn't look like a system entity to me.
I had the same error message with the customerAddress entity.
Turns out I referenced the entity as "customerAddress"
(note the camel case).
But CRM wants logical names of entities and attributes in all lower case. So "customeraddress"
did work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With