8 Replies Latest reply on Nov 9, 2010 7:19 AM by YogLC

    Update Process Data values

    YogLC

      Hi All,

      How can we update process data if we have access to process instance (process id) ?

      Is there any API calls that I can use to do this?

      e.g. with process Id first find the right process and then find available process data variable and then update the process data values.

      Thanks

      YogLC

        • 1. Re: Update Process Data values
          Jasmin Charbonneau Level 4

          I don't believe you can update the process variables.

           

          You can get the variable values using the TaskManagerQueryService but I don't see any API to update them.

           

          Jasmin

          • 2. Re: Update Process Data values
            developwf Level 1

            Hi Jasmin,  Could you please suggest an alternative approach to save process data while working with UI based on HTML/java frameworks.

            A typical use case is:

                 - User invokes a long lived process by submitting values for process variable (ServiceClient.invoke()). Process gets assigned to a user (Assign Task operation)

             

                 - User is presented with the task on web application. User is presented with all process data.( TaskManagerQueryService.getProcessVariableValues() )

                 - User should be able to update process variables n number of times from the web UI

                 - User finally completes task , which moves to next operation

             

             

            many thanks in advance

             

             

            • 3. Re: Update Process Data values
              Jasmin Charbonneau Level 4

              - User invokes a long lived process by submitting values for process variable (ServiceClient.invoke()). Process gets assigned to a user (Assign Task operation)

              Ok so far.

               

              - User is presented with the task on web application.

              Ok. Usually the task is represented by a form (html,pdf,swf). Are you usually a form?

              - User is presented with all process data.( TaskManagerQueryService.getProcessVariableValues() )

              Can you put the value of the process data in the form?

              - User should be able to update process variables n number of times from the web UI

              If the value of the process data are in the form, you could just do a Task.save() to update the task data as many time as you want, then put the data from the task data into process variables when you finally submit.

              - User finally completes task , which moves to next operation

               

               

              The only other option would be to go against the database directly, which is not supported.

               

              Jasmin

              • 4. Re: Update Process Data values
                developwf Level 1

                Jasmin, thanks very much for your response.

                 

                <<

                User is presented with the task on web application.

                Ok. Usually the task is represented by a form (html,pdf,swf). Are you usually a form?

                >>

                 

                In our case user is presented with an HTML page generated from a JSF application. Presentation logic is taken care by the JSF framework. JSF bean interacts with the process manager to obtain process variable values of a given task, and generates an XHTML view, which finally is rendered as HTML page in the browser. We are not using workspace for UI. User TO DO list(inbox) is  built by JSF using the Java API provided by process management. We want the JSF application to drive the saving of process data, completing process steps..etc.

                 

                 

                Not sure if our overall approach is flawed/ overly complex ??

                • 5. Re: Update Process Data values
                  Jasmin Charbonneau Level 4

                  I don't think your approach is flawed.

                   

                  I just think there's a misunderstanding (unless I'm missing something) between the data for the task and the data from the process variable.

                   

                  In process management, we use the User service to assign a form to an individual. This is how you see it in the To Do from Workspace. The User service is really just a pretty name for getting a Task. Now when the user completes the form (from Workspace or other interfaces), what they really do is just use a interface to update the task data before they submit it.

                   

                  So what I think you really want to do, is just use you HTML interface to update and submit the task data, which we have an API for.

                   

                  The process variables are usually used to stored data between the steps in process management.

                   

                  Does that make sense?

                   

                  Jasmin

                  • 6. Re: Update Process Data values
                    YogLC Level 1

                    Hi Jasmin,

                    Thanks for your reply.

                     

                    1) I know the SetValue service can do the job of updating the process data variable (values)  from either taskData or from process data.

                    Will this help if we build a short lived process/ subprocess  that takes input as process  Id, and a map (of process variable name(key) and process data values )  and first finds the right process (based on process id passed) creates patExceContext  and then update the variables using patExecContext's setProcessDataValue... method

                     

                    2) What about saving patExecContext object into custom database (in serialized form) along with process id and later retrieve the object using process id and then using that object  setProcessDataValue... methods ?

                     

                    3) Writing custom submit process (User Service) to update the process data. (as mentioned in LCES2.5 docs) can you provide some samples?

                     

                    Thanks

                    YogLC

                    • 7. Re: Update Process Data values
                      Jasmin Charbonneau Level 4

                      patExecContext won't help since it's going to update the process variable of the current process. If you're in a sub process, you'll only have access to the variables of that sub process.

                       

                      There is no way (other than updating the DB) to update the process variable of a particular process.

                       

                      However, I still think you should just update the task data and not the process variables. The process variables a meant to be used in between steps. The task data is meant to store the data for a particular task.

                       

                      Jasmin

                      • 8. Re: Update Process Data values
                        YogLC Level 1

                        Thanks Jasmin.

                         

                        patExecContext won't help since it's going to update the process variable of the current process. If you're in a sub process, you'll only have access to the variables of that sub process.   >>>>>  will event mechanisim will help (throw event from outside process and catch event within same process and update the data based on event map data)

                         

                        What about #2 and 3.

                         

                        Thanks

                        YogLC