AnsweredAssumed Answered

Saving comment in process without user task

Question asked by ivan_activiti on Nov 25, 2015
Latest reply on Nov 25, 2015 by ivan_activiti
I have a process consisting of a start event, a couple of service tasks, and a mail task. In the start even, there are some form fields users fill out. There is also a comment field which is not part of the form. The comment field is rendered after the form and users have an option to add a comment. On the back end I call the following code to start the process:


ProcessInstance pi = runtimeService.startProcessInstanceByKey(processDefinitionKey, variableMap);

then, I would like to save the comment, by using:


taskService.addComment(null, pi.getId(), commentText);

The line above will only work if there is a user task present in the process, but in this particular process there is no user tasks. So, I am getting
org.activiti.engine.ActivitiObjectNotFoundException: execution doesn't exist
exception.

I realize one of the options would be to write some custom method that would save my comment to the
ACT_HI_COMMENT
table. But is there something out-of-the-box in Activiti that would allow me to save a comment in this use case? I am using version 5.16.3

Thanks,
–Ivan

Outcomes