Dear Forum,

I would like to know what to do when a workflow error occurs and the connection between the workflow and the data record is lost. 

This can also happen when a new version of a process model is published and the existing processes can not continue with the new process.

Is a solution possible to repair this situation?

In production situation it can be a big problem if all the data records can not proceed in the process anymore. 

Is it for instance possible to create a new process on basis of an existing data record and also set the actual status of the new process to a specific activity?

Regards, Joost van der Schoot

  • No labels

7 Comments

  1. Hi Joost,

    To start a process that links to an existing record, you should be able to use the JSON API process start while passing in an existing processInstanceId. This would in effect link the new instance with the previous one so that the same data record is used.

    Btw, what workflow errors do you mean? Do you have any details on that?

    Thanks

    Julian

    1. Hi Julian,

      I am able to start a new process with a jQuery call, but I always get a new process instance.

      You suggested to pass in the existing processInstanceId. How can I do that?

      I tried the following alternative calls, each of these result in a new process instance.

      And as I understand you well, a new process instance will always be created, but I stilldo not get the data attached. 

      These calls I tried (among a series of alternatives): 

      web/json/workflow/process/start/Test:4:RequestHandling?j_username=admin&j_password=admin&processId=287_Test_RequestHandling

      web/json/workflow/process/start/Test:4:RequestHandling?j_username=admin&j_password=admin&var_processId=287_Test_RequestHandling

      web/json/workflow/process/start/Test:4:RequestHandling?j_username=admin&j_password=admin&processInstanceId=287_Test_RequestHandling

      web/json/workflow/process/start/Test:4:RequestHandling?j_username=admin&j_password=admin&var_processInstanceId=287_Test_RequestHandling

      On the workflow errors:

      Several reasons will create these errors such as definition of deadline with a wrong (e.g. format) or non existing workflow variable.

      I have attached a smal testmodel where this situation is created.

      APP_TestV2.zip

      Submit a request with type "Error" and you will execute the activity "Control Request (Error)" with the workflow error.

      This also includes a form with the call to start the process (Maintain Requests) and has two inbox types: a standard one and a datalist one. When I start a new process this will be added to the standard inbox (without data). I would like to see a new process in the datalist inbox.

      Btw:

      How can I, at runtime, know which process version I have to use like the "4" in "Test:4:RequestHandling"?

      How can I set the actual activity in a newly created process? Can I also pass in the activity definition Id in the Json call?

      Thanks for your feedback.

      Regards, Joost

      1. Hi Joost,

        Sorry, the previous JSON call does not handle your use case.  There is a URL you can call to achieve this, but the response is not JSON but HTML. This call is:

        /web/client/app/(:appId)//process/(:processDefId)/start?recordId=(:processInstanceId)

        So if for

        • App ID: Test
        • Process Def ID: RequestHandling
        • Process Instance ID: 2120_Test_Request_Handling

        you could try

        /web/client/app/Test//process/RequestHandling/start?recordId=2120_Test_RequestHandling

        This will create a new process instance but the form data will be linked to 2120_Test_Request_Handling.

        Using the above call, you won't need to specify the process version. In the JSON calls, you can use "latest" without the quotes in place of the version number (How can I start the last version of a process ?).

        There are also JSON calls to start and stop specific activities in a process 

        http://dev.joget.org/community/display/KB/JSON+API#JSONAPI-%2Fweb%2Fjson%2Fmonitoring%2Factivity%2Fstart%2F%28%3AprocessI...

        http://dev.joget.org/community/display/KB/JSON+API#JSONAPI-%2Fweb%2Fjson%2Fmonitoring%2Factivity%2Fabort%2F%28%3AprocessI...

        Regards,
        Julian

        1. Hi Julian,

          I was able to call the url you suggested.

          However, I noticed it is necessary not to call the url, but to navigate to it and execute the returned form.

          Then you will be routed to the first form related to the first activity of the process.

          And indeed the new process is attached to the data record then.

          Is this along the idea of your suggestion, or should it be possible to just execute a call?

          When this procedure is followed, we have a new process, and how can we get  this in sync to the last executed activity in the

          previous process, the one that was lost after a process execution error?

          Would it be an idea to store the activityId during a process and use this to call the json call you suggested?

          In fact I would like to do a 'one shot' repair & sync action to recover a lost process and get the data records into the process again. Ofcourse you do not want the process errors to occur and the best strategy is to prevent this, but now it just can happen.

          Have you been able to reproduce the kind of process errors I reported earlier? I experience these kind of errors frequently when releasing a new changed process.

          Thanks for your kind feedback,

          Joost

          1. Hi Joost,

            I've been able to reproduce the problem which happens as you mentioned. Yes it's best to prevent it by ensuring that the appropriate workflow variables exist with the proper values.

            To do a 'one shot' repair and sync action, maybe you can try making use of the JSON API call /web/json/monitoring/process/copy/(:currentProcessId)/(:newProcessDefId) at http://dev.joget.org/community/display/KB/JSON+API#JSONAPI-%2Fweb%2Fjson%2Fmonitoring%2Fprocess%2Fcopy%2F%28%3AcurrentPro...

            This call starts a new process instance, copying the running activities from the current process instance, and optionally aborts the current one.

            Regards,
            Julian

            1. Hi Julian,

              I tried several JSon calls, but there seems to be a problem in using sub-flows. 

              When I execute a call like : /web/json/monitoring/activity/start/(:processId)/(:activityDefId)

              It sometimes works , but it never works when using the activityDefId of an activity in a subprocess/subflow.

              Maybe this sub-flow model usage could also be the reason that changes in a process model results in errors in the running flows, since I use a lot of subflow models?

              Remember I do not only get the lost process error with wrong wokflow variables. I experience these kind of errors also frequently when releasing a new changed process without any workflow variable errors.

              When you use sub-models yourself and change the process models, then you always get your running workflows back in sync into the new process?

              BTW, the JSon docs suggest the use of an optional parameter to abort the running processes. How can this be applied?

              Just adding a "/true" in the url doesnt work.

              Regards, Joost

              1. Hi Joost,

                Hmm yes it does sound like it's due to the sub-flows, because each sub-flow is actually a separate process instance. Will need to have a deeper look at it.

                For the optional parameter, you should add it as a URL parameter, so it would be something like

                /web/json/monitoring/process/copy/(:currentProcessId)/(:newProcessDefId)?abortCurrent=true

                Regards,
                Julian