There is a method in the Xrm.Utility namespace that we can use to open a quick create form:
https://msdn.microsoft.com/en-us/library/jj602956.aspx
It turns out this method can produce a very vague error:
And you won’t see much in the downloaded log file:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #19A0595DDetail:
<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts”>
<ActivityId>7a9ea5d1-708f-445b-a317-092121619247</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic” />
<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #19A0595D</Message>
<Timestamp>2017-07-31T23:15:30.2657903Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil=”true” />
<InnerFault>
<ActivityId>7a9ea5d1-708f-445b-a317-092121619247</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d3p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic” />
<Message>System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #AC3DBE0D</Message>
<Timestamp>2017-07-31T23:15:30.2657903Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil=”true” />
<InnerFault i:nil=”true” />
<OriginalException i:nil=”true” />
<TraceText i:nil=”true” />
</InnerFault>
<OriginalException i:nil=”true” />
<TraceText i:nil=”true” />
</OrganizationServiceFault>
There can probably be other reasons for this, but, if you run into it, make sure to check if you are passing correct attribute names through the “parameters”. For example, if you just copy-paste that sample javascript from the msdn page above, you’ll be passing “name” attribute through the parameters. However, some entities don’t have “name” attribute at all.. Consider a Case entity – what you need to use, instead, is “title” attribute:
function quickCreateCase(){ var accountid = Xrm.Page.data.entity.getId(); var accountName = Xrm.Page.getAttribute("name").getValue(); var parentAccount = { entityType: "account", id: accountid, name: accountName }; var parameters = {}; parameters.title = accountName; parameters.customerid = accountid; parameters.customeridname = accountName; parameters.customeridtype = "account"; Xrm.Utility.openQuickCreate("incident", parentAccount, parameters); }