Search code examples
javaalfresco

How can i get current workflowinstance id using java?


I am using Alfresco community edition-5.1.x , I have created custom advanced workflow, In workflow have step of auto generate document functionality using script step (java delegate), I need to save document as a workflowintanceid of workflow, so how can I get the workflowintanceid using java code?


Solution

  • If I understood your question correctly, you want to get the workflow instanceid on your delegate. If so, then use the below code in your delegate.

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

    Please let me know, if I understood your question wrongly.