Hi,
I have managed to create a hierarchy provider and start from the PO requester. But it is not stopping based on the condition of invoice signing limit. It keeps going up the based on the position hierarchy and not the heirarchy assigned to the workflow.
Is there any code or configuration missing. Kindly find below the code and configurations.
class MY_TaskWorkflowHierarchyProvider implements WorkflowHierarchyProvider
{
const str Workflow_Employee = 'Employee';
ExpressionDataSource dataSource;
WorkflowHierarchyProviderHelper helper;
protected void new()
{
helper = WorkflowHierarchyProviderHelper::construct();
dataSource = ExpressionDataSource::newDataSourceDefinition(Workflow_Employee, "@SYS121302");
helper.setupDataSource(dataSource);
}
public static MY_TaskWorkflowHierarchyProvider construct()
{
return new MY_TaskWorkflowHierarchyProvider();
}
public anytype convertUserIdToNodeDataType(userId _userId,
WorkflowContext _workflowContext)
{
return helper.convertUserIdToNodeDataType(_userId, _workflowContext);
}
public ExpressionDataSource getDataSource()
{
return dataSource;
}
public WorkflowHierarchyProviderNode getNextNode(anytype _nodeId,
WorkflowHierarchyLevel _level,
WorkflowContext _workflowContext)
{
return helper.getNextNode(_nodeId, _level, _workflowContext, dataSource);
}
public extendedDataTypeName getNodeDataType()
{
return helper.getNodeDataType();
}
public Set getSupportedDataType()
{
Set supportedDataTypes = helper.getSupportedDataType();
if(!supportedDataTypes)
{
supportedDataTypes = new Set(Types::String);
}
return supportedDataTypes;
}
public anytype convertToNodeDataType(extendedDataTypeName _dataType,
anytype _value,
WorkflowContext _workflowContext)
{
HcmPersonnelNumberId personnelNumberId;
VendInvoiceInfoTable vendInvoiceInfoTable = this.getVendInvoiceInfoTableFromContext(_workflowContext);
PurchTable purchTable;
purchTable = purchTable::find(VendInvoiceInfoTable::findRecId(_workflowContext.parmRecId()).PurchId);
personnelNumberId = HcmWorker::find(purchTable.Requester).PersonnelNumber;
return personnelNumberId;
}
private VendInvoiceInfoTable getVendInvoiceInfoTableFromContext(WorkflowContext _context)
{
VendInvoiceInfoTable vendInvoiceInfoTable;
if (_context.parmTableId() == tableNum(VendInvoiceInfoTable))
{
vendInvoiceInfoTable = VendInvoiceInfoTable::findRecId(_context.parmRecId());
}
else if (_context.parmTableId() == tableNum(VendInvoiceInfoLine))
{
vendInvoiceInfoTable = VendInvoiceInfoLine::findRecId(_context.parmRecId()).vendInvoiceInfoTable();
}
return vendInvoiceInfoTable;
}
}






15,000

25,000


