How can we add a process comment with APIs ?


Hi !

I'm trying to add a comment to the process programmaticaly.
I have tried to add a connectorOUT, which takes my comment value from the form contract, and then call this code :

apiAccessor.processAPI.addProcessComment(processInstanceId, myCommentContract)

The problem is that the comment is added by the System User, and thus is not visible on the Comments Page.

Is there a way to add a comment to the Comments Page ?

Things I could try :

  • In a connector OUT : get the taskPerformerID, connect him, and execute "addProcessComment"


  • In the form : call the REST API (POST /bonita/API/bpm/comment ) on the submit button OnClick (is it possible ?)

Thanks :)


Submitted by yajita.y on Wed, 03/08/2017 - 14:19

debes agregar el comentario en las acciones de una tarea humana, ahí te salen registradas con el usuario logeado

You must add the comment in the actions of a human task, there they are registered with the loggeduser

Submitted by p.clainchard on Thu, 03/09/2017 - 10:24

I understand that, but how can it be done ?
If I do it in a script from the designer, the loggedUser is "System".

I managed to add a comment from a form page, using a button that calls the REST API api/bpm/comment, but that implies my user to click on one button to submit the comment, and then on an other to submit the form.

One solution could be to create a new custom button that calls the API, and then calls the submit form action ? Not sure if we can do it ?

Submitted by yajita.y on Thu, 03/09/2017 - 14:34

I use this within a human task action, and it is saved when the form is submitted. By rest api there is no way.

apiAccessor.getProcessAPI().addProcessComment(rootProcessInstanceId, field_comentario1);
}catch(Exception e){}

Submitted by p.clainchard on Mon, 04/24/2017 - 10:08

That does not work anymore in Bonita 7.

All the scripts are executed by the system user

1 answer


Answer deleted -- sorry: it didn’t answer your question.
(I should read more carefully before I post :) )