You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This is an improved version of Multiple Approval shared earlier based on feedback from Ivan Shu.

In this version, a Deadline is added to automatically check for approval periodically. This would prevent the script in "Process Approval" from not being able to get the final approval count needed shall there be more than 1 instance of approval running at the same time.

KB:Download the App

EDIT:

1. Process Approve -> Tool: Update Application

Change 

 

workflowManager.assignmentComplete(actId, null);
to
workflowManager.assignmentComplete(actId);

 

assignmentComplete method accepts one parameter only.

2. Process Apply -> Tool: Process Approval

else if(rowCount >= approvalCount){
workflowManager.processVariable(processId, statusVariableName, "Approved");
}

Isn't really complete as there will be still running processes for other users if you are accepting approval for eg. 2 out of 3 users.

example fix 

else if(rowCount == Integer.valueOf(no_approvals)){ //no_approvals is my own variable where I store number of assignees for request to be approved
    	String[] approvalIdsSplit = approvalIds.split(",");
	for(String approvalId : approvalIdsSplit){
		if(!approvalId.equalsIgnoreCase("") && !approvalId.equalsIgnoreCase(recordId)){
			try{
				workflowManager.processAbort(approvalId);
                System.out.println(" aborting : " + approvalId);
			}catch(Exception e){
                    System.err.println("Exception: " + e.getMessage());
			}			
		}
	}
	workflowManager.processVariable(processId, statusVariableName, "approved");
}
  • No labels