The comment table seems to omit proc_inst_id. I noticed though it is there for the “invoice” sample comments.
Hi @lenny_h,
Could you please share with us how did you add those comments?
Which API did you use or do you create them via the UI in the webapps?
Best regards,
Yana
Hi @Yana!
I created these comments simply by using the REST API in JS
await this.axios({
method: "post",
url: `/engine-rest/task/${this.taskUUID}/comment/create`,
headers: {
"Content-Type": "application/json",
Accept: "application/json"
},
data: {
message: fullcomment
}
})
Hi Lenny,
The process instance is not being populated as this API does not set it.
The comment is created for the task and not for the process instance.
Unfortunately, it is not possible to add a process instance comment via the REST API, you can do that via Java API and here is how it is done in the invoice
example: link
I hope this helps you.
Best regards,
Yana
My goal was to get all comments for a single process instance. I just INNER JOINED the process and task instance tables to comments and added a helper api method. We have 1000s of existing comments, so this is working for now.
I though that the process instance would always be tagged per task, but I see now it is is a bit different.
Thanks!
Lenny
Hey Lenny,
Sorry to hear that.
We have separation between task and process instance comments so to say, but it seems you went in right direction to overcome this.
For future use you might consider the comment creation for process instances if that suits better for your scenario.
Best regards,
Yana
Hi Yana!
So a global process instance comment lives in the same table as a task comment. What would the taskid field contain for a process instance comment?
Thanks!
Lenny
Via the Java API you can provide:
// both ids
taskService.createComment(taskId, processInstanceId, "My awesome comment");
// or only one of them
taskService.createComment(null, processInstanceId, "My awesome comment");
taskService.createComment(taskId, null, "My awesome comment");