码迷,mamicode.com
首页 > 其他好文 > 详细

通过代码更改业务流程的阶段时,提示权限错误

时间:2018-10-26 14:28:28      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:color   lis   ready   herf   bind   output   通过   step   serve   

错误描述

SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: 00000000-0000-0000-0000-000000000000, OwnerId: 37c8e728-b05c-4b30-ac41-8ee39aa51180, OwnerIdType: 8 and CallingUser: d2225d2c-5ae4-e711-80fd-008cfaf9d41d. ObjectTypeCode: 2500, objectBusinessUnitId: 2d99bd27-8cca-e111-8d7d-005056c00008, AccessRights: CreateAccess
其中:
  • OwnerId:37c8e728-b05c-4b30-ac41-8ee39aa51180 为SYSTEM用户
 
相关代码
var processInstanceId= "<process instance id>";  //BusinessProcessFlowInstanceId
var nextStageId = "<next stage id>";             //下个阶段对应的ProcessStageId

var retrievedProcessInstance = service.Retrieve("opportunitysalesprocess",  processInstanceId, new ColumnSet("activestageid"));
retrievedProcessInstance["activestageid"] = new  EntityReference("processstage",nextStageId);
service.Update(retrievedProcessInstance);

    

通过Trace工具,跟踪出来的日志如下:
at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x64
at SystemUserProxy.Execute(PipelineExecutionContext context)  ilOffset = 0x21
at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x93
at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0xDE
at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x35
at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x221
at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
at ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity entity, FilterExpression filter, Int32 invocationSource, ExecutionContext context)  ilOffset = 0x108
at ExtensiblePlatformMessageDispatcher.Update(BusinessEntity entity, FilterExpression filter, ExecutionContext context)  ilOffset = 0xA
at BusinessProcessObject.UpdateWithPipelineAndExtensions(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x80
at BusinessProcessObject.Update(IBusinessEntity entity, ExecutionContext context, Boolean updateWithPipeline)  ilOffset = 0x4F
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
at MethodBase.Invoke(Object obj, Object[] parameters)  ilOffset = 0x0
at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x64
at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x43
at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x25D
at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x64
at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x93
at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0xDE
at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x35
at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x218
at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid callerRegardingObjectId, UserType userType, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x22D
at ExternalMessageDispatcher.Execute(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid callerRegardingObjectId, UserType userType, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId)  ilOffset = 0x0
at OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode, Object operation, UserType targetUserType)  ilOffset = 0x24A
at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)  ilOffset = 0x26
at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x4B
at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x1B
at OrganizationSdkService.Execute(OrganizationRequest request)  ilOffset = 0x6
at   ilOffset = 0xFFFFFFFF
at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  ilOffset = 0x24C
at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  ilOffset = 0xC4
at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  ilOffset = 0x48
at MessageRpc.Process(Boolean isOperationContextSet)  ilOffset = 0x65
at Wrapper.Resume(Boolean& alreadyResumedNoLock)  ilOffset = 0x1B
at ThreadBehavior.ResumeProcessing(IResumeMessageRpc resume)  ilOffset = 0x8
at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x79
at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x9
at QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()  ilOffset = 0x35
at ThreadPoolWorkQueue.Dispatch()  ilOffset = 0xA4
>Web Service Plug-in failed in SdkMessageProcessingStepId: {BB48066E-F22F-412F-A530-91F72E4B859B}; EntityName: new_bpf_3e8ebee6a2bc44519c5fb146b085413a; Stage: 35; MessageName: Update; AssemblyName: Microsoft.Crm.ObjectModel.GlobalActiveStagePlugin, Microsoft.Crm.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.ObjectModel.GlobalActiveStagePlugin; Exception: Unhandled Exception: Microsoft.Crm.CrmSecurityException: SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: 00000000-0000-0000-0000-000000000000, OwnerId: 37c8e728-b05c-4b30-ac41-8ee39aa51180,  OwnerIdType: 8 and CallingUser: d2225d2c-5ae4-e711-80fd-008cfaf9d41d. ObjectTypeCode: 2500, objectBusinessUnitId: 2d99bd27-8cca-e111-8d7d-005056c00008, AccessRights: CreateAccess
在 Microsoft.Crm.BusinessEntities.SecurityLibrary.AccessCheckEx2(ExecutionContext context, SecurityPrincipal principal, SecurityPrincipal ownerPrincipal, Guid objectId, Int32 objectTypeCode, Guid objectBusinessUnitId, AccessRights rights)
在 Microsoft.Crm.BusinessEntities.SecurityLibrary.AccessCheckEx(ExecutionContext context, SecurityPrincipal ownerPrincipal, Guid objectId, Int32 objectTypeCode, Guid objectBusinessUnitId, AccessRights rights)
在 Microsoft.Crm.BusinessEntities.SecurityLibrary.AccessCheckEx(ExecutionContext context, SecurityAttributes attributes, AccessRights rights)
在 Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandlerEntityPrivilegeCheck(Object sender, SecurityTraits traits, SecurityAttributes attributes, ExtensionEventArgs e)
在 Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateSecurityCheck(Object sender, ExtensionEventArgs e, BusinessEntity entity)
在 Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandler(ExtensionEventArgs e, Object sender)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.PreCreateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context, Boolean createWithPipeline)
在 Microsoft.Crm.Platform.Server.UserEntityUISettingsServiceAdapter.UpsertByEntityTypeCodeAndUser(Int32 typeCode, Guid userId, String recentlyViewedXml, Dictionary`2 entityList)
在 Microsoft.Crm.Platform.Server.UserEntityUISettingsServiceAdapter.UpsertUserSettings(List`1 clientEntityList, List`1 clientViewList, ICollection`1 etcList, Guid userId)
在 Microsoft.Crm.Platform.Server.UserEntityUISettingsServiceAdapter.Upsert(IRecentlyViewedRecord recentlyViewedRecord, Guid userId)
在 Microsoft.Crm.Platform.Server.RecentlyViewedProcessService.PinProcessForTargetEntityRecord(Guid processInstanceId, Guid processId, IEntityReference targetEntity, Guid userId)
在 Microsoft.Crm.Platform.Server.SelectionAlgorithmService.PinProcessOnTargetEntity(IBusinessEntity processInstance, IEntityReference targetEntityReference, IExecutionContext context)
在 Microsoft.Crm.Platform.Server.SelectionAlgorithmService.RetrieveDefaultProcessInstance(Guid targetEntityId, Int32 targetEntityTypeCode, String targetEntityLogicalName, Boolean moreProcessData, IExecutionContext executionContext)
在 Microsoft.Crm.Platform.Server.InjectProcessInstanceAttributesExtension.HandlePostRetrieve(Object sender, ExtensionEventArgs e)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostRetrieveEventHandler.Invoke(Object sender, ExtensionEventArgs e)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.TryRetrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode, DatabaseQueryTarget queryTarget, BusinessEntity& businessEntity)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode, DatabaseQueryTarget queryTarget)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode)
在 Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
在 Microsoft.Crm.Sales.ObjectModel.QOIService.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
在 Microsoft.Crm.ObjectModel.BusinessProcessFlowServiceInternalHandler`1.NavigateToNextEntity(IBusinessEntity bpfInstanceToUpdate, Guid nextEntityId, String nextEntityLogicalName, Guid newActiveStageId, String newTraversedPath, Guid processId, ExecutionContext context, WorkflowStep workflowStep)
在 Microsoft.Crm.ObjectModel.WorkflowPluginHelper.NavigateToNextEntity(Entity customBpfEntity, IExecutionContext executionContext, IPluginExecutionContext pluginExecutionContext)
在 Microsoft.Crm.ObjectModel.GlobalActiveStagePlugin.Execute(IServiceProvider serviceProvider)
在 Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
在 Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
.
 
 
解决方式
 
  • 安装补丁包,升级到8.2.2.112版本即可,CRM2016-Server-KB4046795-CHS-Amd64

 

通过代码更改业务流程的阶段时,提示权限错误

标签:color   lis   ready   herf   bind   output   通过   step   serve   

原文地址:https://www.cnblogs.com/lvdongbo/p/9855796.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!