WorkflowWorkItemDelegationParameters delegationParameters;
utcdatetime delegateDate = DateTimeUtil::utcNow();
userId delegateUser;
WorkflowTable workflowTable;
SysWorkflowTable sysWorkflowTable;
sysWorkflowTable = SysWorkflowTable::find(_workflowElementEventArgs.parmWorkflowContext().parmWorkflowCorrelationId());
select firstonly workflowTable
where workflowTable.Type == WorkflowConfigurationType::Definition
&& workflowTable.SequenceNumber == sysWorkflowTable.ConfigurationSequenceNumber;
while select delegationParameters
where delegationParameters.User == _currentUser
&& delegationParameters.Enabled == NoYes::Yes
&& delegationParameters.FromDate < delegateDate
&& delegationParameters.ToDate > delegateDate
{
switch (delegationParameters.Type)
{
case WorkflowWorkItemDelegationType::All:
info("All "+delegationParameters.DelegateTo);
break;
case WorkflowWorkItemDelegationType::Category:
if (delegationParameters.CategoryName == workflowTable.CategoryName)
{
info("module "+delegationParameters.DelegateTo);
}
break;
case WorkflowWorkItemDelegationType::Configuration:
if (delegationParameters.ConfigurationSequenceNumber == workflowTable.SequenceNumber)
{
info("worklfow "+delegationParameters.DelegateTo);
}
break;
default:
throw error(strFmt("@SYS122124", enum2str(delegationParameters.Type)));
}
}
utcdatetime delegateDate = DateTimeUtil::utcNow();
userId delegateUser;
WorkflowTable workflowTable;
SysWorkflowTable sysWorkflowTable;
sysWorkflowTable = SysWorkflowTable::find(_workflowElementEventArgs.parmWorkflowContext().parmWorkflowCorrelationId());
select firstonly workflowTable
where workflowTable.Type == WorkflowConfigurationType::Definition
&& workflowTable.SequenceNumber == sysWorkflowTable.ConfigurationSequenceNumber;
while select delegationParameters
where delegationParameters.User == _currentUser
&& delegationParameters.Enabled == NoYes::Yes
&& delegationParameters.FromDate < delegateDate
&& delegationParameters.ToDate > delegateDate
{
switch (delegationParameters.Type)
{
case WorkflowWorkItemDelegationType::All:
info("All "+delegationParameters.DelegateTo);
break;
case WorkflowWorkItemDelegationType::Category:
if (delegationParameters.CategoryName == workflowTable.CategoryName)
{
info("module "+delegationParameters.DelegateTo);
}
break;
case WorkflowWorkItemDelegationType::Configuration:
if (delegationParameters.ConfigurationSequenceNumber == workflowTable.SequenceNumber)
{
info("worklfow "+delegationParameters.DelegateTo);
}
break;
default:
throw error(strFmt("@SYS122124", enum2str(delegationParameters.Type)));
}
}
No comments:
Post a Comment