Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This is an improved version of Multiple Approval shared earlier based on feedback from 根据 Ivan Shu.的反馈和分享,这是  Multiple Approval  改进版本

在这个版本中,添加了Deadline 以便定期自动检查批准。这将防止“过程审批”中的脚本无法同时运行多个审批实例,从而无法获得所需的最终批准计数。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 AppEDIT:

编辑:

1.

...

过程审批 - >工具:更新应用程序

更改

 

Code Block
languagejava
themeDJango
workflowManager.assignmentComplete(actId, null);
to
workflowManager.assignmentComplete(actId);

 assignmentComplete method accepts one parameter only.

assignmentComplete方法只接受一个参数。

2.

...

流程应用 - >工具:流程审批

Code Block
languagejava
themeDJango
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.

如果您接受3个用户中的2个用户的批准,其他用户的运行过程将不会完全完成。

示例修复example fix 

Code Block
languagejava
themeDJango
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");
}