如何使用 java 获取当前工作流实例 ID?

How can i get current workflowinstance id using java?

我正在使用 Alfresco community edition-5.1.x,我创建了自定义高级工作流,在工作流中有使用脚本步骤(java 委托)自动生成文档功能的步骤,我需要将文档保存为工作流程的 workflowintanceid,那么如何使用 java 代码获取 workflowintanceid

如果我没有正确理解你的问题,你想在你的委托上获取工作流实例 ID。如果是这样,请在您的委托中使用以下代码。

@Override
public void execute(DelegateExecution execution) throws Exception
{
 String workflowInstanceId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId(); 
 //.... rest of the code goes here...
 }

如果我理解错了你的问题,请告诉我。