AX2012 审批流流转到已停用的域账号导致审批流停止
AX 2012 中当审批流流转到某个节点时,如果在该节点的审批人的域账号被停用,审批流将会停止,会报如图的错误:
要解决这个问题,得修改标准功能,需要修改SysWorkflow和SysWorkflowWorkItem两个类
public server static void fault( Microsoft.Dynamics.AX.Framework.Workflow.Runtime.WorkflowContext _workflowContext, WorkflowUser _user, WorkflowFaultMessage _faultMessage) { UserConnection connection; SysWorkflowFaultTable faultTable; setPrefix(classStr(SysWorkflow) + '-' + staticMethodStr(SysWorkflow, fault)); new InteropPermission(InteropKind::ClrInterop).assert(); if (CLRInterop::isNull(_workflowContext)) { throw error(strFmt("@SYS104836", staticMethodStr(SysWorkflow, fault), varStr(_workflowContext))); } // CR <Hotfixed> VAR on 2016-07-26 at 15:04:07 Changed by Kim -Begin if (SysWorkflowTable::find(CLRInterop::getAnyTypeForObject(_workflowContext.get_WorkflowCorrelationId())).RecId != 0) // CR <Hotfixed> VAR on 2016-07-26 at 15:04:07 Changed by Kim -End { if (appl.ttsLevel() == 0) { SysWorkflow::internalFault(_workflowContext, _user, _faultMessage); } else { // We are in a nested transaction so we want to do the fault even if the outer transaction // is rolled back so we do it on a sperate connection. connection = new UserConnection(); faultTable.setConnection(connection); if (!SysWorkflowFaultTable::exist(_workflowContext.get_RootCorrelationId())) { connection.ttsbegin(); faultTable.RootCorrelationId = _workflowContext.get_RootCorrelationId(); faultTable.FaultMessage = _faultMessage; faultTable.User = _user; faultTable.insert(); connection.ttscommit(); } } } CodeAccessPermission::revertAssert(); }
// EDD number Hotfix // EDD description Hot fix // Layer var // Model VAR Model // // Developer Date Comments // -------------- ----------------- ------------------------------ // Kim.Ding 三月-22-2016 13:46:01 Created public static boolean TEC_checkADUser(UserId _userId) { xAxaptaUserManager mgr; xAxaptaUserDetails det; UserInfo userInfo; boolean ok = true; ; mgr = new xAxaptaUserManager(); select userInfo where userInfo.Id == _userId; det = mgr.getDomainUser(userInfo.NetworkDomain,userInfo.id); if (det == null) { ok = false; } return ok; }
/// <summary> /// Microsoft internal use only. /// </summary> /// <param name="_workItemContext"> /// An instance of the <c>CLRObject</c> class. /// </param> /// <param name="_isClaimed"> /// A <c>WorkflowWorkItemClaimed</c> value. /// </param> /// <returns> /// A <c>recId</c> value. /// </returns> private server static RecId create( Microsoft.Dynamics.AX.Framework.Workflow.Runtime.WorkItemActivityContext _workItemContext, WorkflowWorkItemClaimed _isClaimed) { ..... userContext = _workItemContext.get_User(); user = userContext.get_UserId(); // CR <Hotfix> VAR on 2016-03-22 at 13:49:48 Changed by Kim -Begin if (!SysWorkflowWorkItem::TEC_checkADUser(user)) { return 0; } // CR <Hotfix> VAR on 2016-03-22 at 13:49:48 Changed by Kim -End autoDelegators = userContext.get_Delegators(); sysWorkflowDocument = SysWorkflowDocument::newDocument( SysWorkflowConvert::toXppWorkflowContext(workflowContext), versionTable.workflowTable().TemplateName, user); .... }