Is there any way to push form's field data to dashboard comment field

hello,

I create one approval process ,
now when user log in to system he can find process status in comments on dashboard
now when user go to task and fill form and then write some comment in filed of form .
and store in variable

but i want that comment field of form , next user can see on dashboard’s (portal) comment .
how to achieve it

In order to add a comment with a data from a form, you can add an action to the form and write the next groovy code:

apiAccessor.getProcessAPI().addComment(rootProcessInstanceId, field_TextField1);

replace field_TextField1 with your field_<name>

In that case, your comment will be added to the root process with the logged user. Adapt as you want.

Thank you so much for reply , i m new in this environment .
pl can u give brief description .

i create on form and on text field ‘cmnt’
now in submit’s button’s > general tab > action >
add action
now there is two field

---- takes value of -----
now exactly where i have to write code ?

i tried by
---- takes value of -Code = give error
Variable – takes value of – Code = give error

what mistake i m doing

Thanks in advance