3 Replies Latest reply on Nov 13, 2005 9:01 AM by gwittwer

    Comment for proccessInstance

    gwittwer

      Hello

      How can I generate a comment for a processInstane?
      Workflow:

      1. User creates new ProcessInstance (Start processdefinition)
      2. User must write a comment for this processinstance (something like a description of the current processinstance)
      3. The comment will be shown in every task of the processInstance and for all users / swimlane.

      Why I like to do this:

      Its not very nice to show all open tasks with the taskname and no futher informations. I would like to show taskname and the description of the processInstance in the "open tasks list".

      Do you have a good idea how to do this? I found a class org.jbpm.graph.exe.Comment, which is just for the current taskinstance. Why is the comment member not implemented for the ProcessInstance class?

      Thank you for your ideas and help!

      Regards
      Gerhard

        • 1. Re: Comment for proccessInstance
          aguizar

          Comments are added by actors and scoped to a task. A task instance has an actor, hence this actor may add comments.

          The creation of a process instance is not always associated with an actor. If it is, then it has a start task, and the comment would belong to that task.

          If you want a comment viewable from all tasks, you can use a variable, have the initial actor write it, and then read it in other tasks.

          • 2. Re: Comment for proccessInstance
            kukeltje

            hmm.. not completely true Alex. On one of my jBPM journeys, I did this:

            myComment="any text";
            context.getProcessInstance().getRootToken().addComment(myComment.toString());


            It add's info to the token, and since the root token is kind of the basis for the process instance. It works.

            In the tasklist I do:
            <h:outputText value="#{taskInstance.token.processInstance.rootToken.comments[0].message}" />


            If you add more comments, you can use [1], [2]

            I'm not saying this is better then using a variable, but is does kind of work good, and you do not have to define the variable in each task.

            • 3. Re: Comment for proccessInstance
              gwittwer

              Hello

              Thanks for your solutions.
              I think the second solution (Ronald's) is the better one. I don't like to do this with variables, because it's something like a descpription of the actual process instance (to show not just the name of the open tasks in the webapplication) and should not change the processdefinition.xml (in my case create with an own application, by different users). I don't like to extend my application with the constraint, that every task must have a comment-variable, because the application should be upgradeable for other BPM's.

              I will test the "root-token-case".

              Thank you
              Gerhard