Requirement:
Can you send a direct workflow approval request to an employee in the system? You can’t do it in standard workflow.
I.e. Can the user select who to send it to. Rather than the template determining it by Role/Hierarchy or specific user.
Solution:
You can do this very easily witha simple mod.
In this example we will look at purchase requisition workflow.
1. Add a new field to the purchase requisition header. Called “Direct approver” (Employee table).
2. Create a new class called
with the following methods
Now change the task/approver ParticipantProvider to point to your new class.
When you configure your workflow it should look like this:
Can you send a direct workflow approval request to an employee in the system? You can’t do it in standard workflow.
I.e. Can the user select who to send it to. Rather than the template determining it by Role/Hierarchy or specific user.
Solution:
You can do this very easily witha simple mod.
In this example we will look at purchase requisition workflow.
1. Add a new field to the purchase requisition header. Called “Direct approver” (Employee table).
2. Create a new class called
with the following methods
public class PurchReqWorkflowParticipantProvider extends WorkflowUserGroupParticipantProvider
{
}
public WorkflowParticipantTokenList getParticipantTokens()
{
WorkflowParticipantTokenList tokenList = WorkflowParticipantTokenList::construct();
;
tokenList = super();
//Hardcoded to make it a readable
tokenList.add('DIRECTAPPROVER', 'Direct approver');
return tokenList;
}
public WorkflowUserList resolve(WorkflowContext _context,
WorkflowParticipantToken _participantTokenName)
{
PurchTable purchTable;
WorkflowUserList userList = WorkflowUserList::construct();
;
userList = super(_context,_participantTokenName);
if (_participantTokenName == 'DIRECTAPPROVER')
{
//DirectApprover is the new field I created on the PurchTable
//I did it all in 1 call but you could break it up to make it readable
userList.add(
SysCompanyUserInfo::findEmplId(
PurchTable::findRecId(
_context.parmRecId()).DirectApprover).UserId);
}
return userList;
}
public static PurchReqWorkflowParticipantProvider construct()
{
return new PurchReqWorkflowParticipantProvider();
}
Now change the task/approver ParticipantProvider to point to your new class.
When you configure your workflow it should look like this: