3 Replies Latest reply on Apr 18, 2013 4:25 AM by atran

    Passing data to a work item handler

    out_sider

      My question is quite simple.

       

      I know that is possible to declare a Work Item Definition where some parameters are String and alike. Then the user can simply fill those parameters using the Web Designer in More properties and data assign. But I want those parameters to be already defined programmatically.

       

      What I mean is this scenario:

       

      • User fills a form provided by my application
      • Work Item Definition is generated holding the data inputed by the user
      • Work Item Definition is sent to guvnor through the Rest API
      • User designs a process using the Service Task corresponding to the previously defined Work Item Definition
      • Work Item Handler has access to the data inputed by the User when he/she filled the form and was holded on the Work Item Definition. Not dated inputed in the guvnor web designer.

       

      In fact if this worked it would be exactly what I needed:

       

      import org.drools.process.core.datatype.impl.type.StringDataType;
      [
        // the Java Node work item located in:
        // project/src/main/resources/META-INF/JavaNodeDefinition.conf
        [
          "name" : "JavaNode",
          "parameters" : [
            "UserName" : "John",
          ],
          "displayName" : "Java Node",
          "icon" : "icons/java.gif"
        ]

      ]

       

      But unfortenly (at least to my understanding) parameter literal values can't be defined in the Work Item Definition...only what type it is...

       

      As such how can I let the user define an Activity and hold data in it, place it in the Workflow using the designer and then colect data from the Work Item Definition?

       

      The user shouldn't define anything else after the WID is done...meaning he/she won't be inputing data in the Service Task more properties within the designer...

      all the info must be holded when the WID is generated.

        • 1. Re: Passing data to a work item handler
          swiderski.maciej

          As you already found out yourself, Work Item definition is only a structure of the work item rather than the instance of it. Why not let users to fill in those details on process in web designer if they are constant strings and will apply to all instances of that process or on process instance start if these values are instance specific?

          • 2. Re: Passing data to a work item handler
            out_sider

            Thanks for the reply and suggestion.

             

            The reason for wanting to define the work item data outside the web designer is due to the complexity of the data.

             

            A rather complex form is necessary to define the atributes of the Service Task (represented by the Work Item Definition) and doing that assignment using the Drools Web Designer built in form isn't very intuitive.

             

            Although custom forms seem to be planned for future release, for now I would still need to do some sorte of javascript hack to catch click events on the designer and launch my form (at least that's what I undestood).

             

            What I'm thinking of doing is considering that each filled form will be a Service Task I can fetch my data structure using the workItem.getName();...I'm hopping it will work .

            • 3. Re: Passing data to a work item handler
              atran

              Hi,

               

              I am also interested in this feature. Indeed, I think it is a good idea to pre-fill an attribute with a default value so that users don't have to fill everything and change only what they want. Mr. Maciej, do you think it will be easy to do that? Thank you.

               

              EDIT: I found out that a plugin implementation could do this.