Return the processid when starting a workflow

Please forgive me as I’m very new to Flowable. I’m currently calling the start workflow process from a JOB that runs as scheduled. When I start the process I need to be able to get the processid back for that specific workflow. How would that be accomplished. Any assistance would be greatly appreciated.

runtimeService.startProcessInstanceById(processName, variables);

Steve

Hey @snorris,

When you run runtimeService.startProcessInstanceById(processName, variables) you get back the started ProcessInstance. You can get the id of that process instance through ProcessInstance#getId

Cheers,
Filip

Filip,

Thank you, it worked perfectly.

Steve

How would I get the processid when the workflow is complete. Again, I appreciate the assistance and direction.

ProcessEngine processEngine = ProcessEngines.getProcessEngine(dbname);
TaskService taskService = processEngine.getTaskService();

taskService.complete(taskID, variables);

Regards

Steve

Hi @snorris,

as soon as the task is completed the runtime information is gone and you would need to search with the historyService in case you have the history enabled for your process instance / engine.

Valentin