尝试为父实体“帐户”打开“约会”的快速创建表单时遇到错误。下面是我要实现的代码。不确定我在哪里做错了:
let parent = {};
parent['entityType'] = "account";
parent['id'] = "xxxx";
parent['name'] = "xxx";
var entityFormOptions = {};
entityFormOptions["entityName"] = "appointment";
entityFormOptions["createFromEntity"] = parent;
entityFormOptions["useQuickCreateForm"] = true;
entityFormOptions["openInNewWindow"] = false;
// Open the form.
Xrm.Navigation.openForm(entityFormOptions, params).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});
这是我得到的错误:
{“错误”:{“代码”:“ 0x80040e01”,“消息”:“没有实体图 为给定实体定义“,” innererror“:{” message“:”没有 为给定定义的实体图 实体“,”类型“:” System.ServiceModel.FaultException
1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]","stacktrace":" at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary
2 可选参数)\ r \ n位于 Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Execute(OrganizationRequest 请求,ExecutionContext executeContext)\ r \ n位于 Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.ExecuteOperation(CrmODataExecutionContext 上下文,EdmOperation edmOperation,字典2 parameters, Dictionary
2个boundParameters)\ r \ n位于 Microsoft.Crm.Extensibility.OData.ActionController.ProcessOperationRequest(字符串 operationName,字典2 operationParameters, EntityReference entityReference, String boundEntityName, String boundEntityType)\r\n
1个功能, IEnumerable
at Microsoft.Crm.Extensibility.OData.ActionController.<>c__DisplayClass12_0.<GetUnboundFunction>b__0()\r\n at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func1 additionalCustomProperties)\r\n at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func
1函数)\ r \ n位于 lambda_method(Closure,Object,Object [])\ r \ n在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor。<> c__DisplayClass10.b__9(Object 实例,Object [] methodParameters)\ r \ n位于 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext,IDictionary`2参数,CancellationToken cancelToken)\ r \ n ---从先前位置开始的堆栈结束跟踪 引发异常的位置--- \ r \ n System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ r \ n
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ r \ n
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ r \ n
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()“}}}
答案 0 :(得分:0)
我认为这不是有效的查询值。尝试这样:
var lookup = new Array();
lookup[0] = new Object();
lookup[0].id = "xxx";
lookup[0].entityType = "account";
lookup[0].name = "xxx";
//set lookup
entityFormOptions["createFromEntity"] = lookup;
答案 1 :(得分:0)
谢谢大家,我已经解决了我的问题。看来我拥有的代码没有父子关系,因此出现错误。