Changing Process Datafield values outside of the application

  • 13 January 2009
  • 4 replies
  • 1 view

Badge +8

I've got a process instance that has stopped prematurely due to a wrong value in a process datafield. I need to change that value so that I can execute a GotoActivity and get the process started up again.


Our workflow is complex, and has several points were the workflow diverges into parallel tasks, then converges back to a single path. When it diverges, it checks some XML Schema values (checkboxes on the Infopath form) and sets some datafields to indicate whether or not certain activities that are required have been completed. As these activities are completed the datafields are set to true. At the point of convergence, the precrule checks these datafields to be sure that all of the required activities are complete. This is required because some paths may come to the convergence point before others are done.


So there was an error in the logic setting the datafields... one of them was set to be required, but because of other values selected on the form it really wasn't required, so it didn't go down that particular path. When the last activity hit the convergence point, the precrule evaluated false because of this one flag that never got set to completed.


We built an activity into our workflow that gives us the capability to change XML fields for a running process. It is in parallel to the entire workflow, and if used will restart itself after saving the process data. This is what keeps this particular instance active, but with no other available activity. As a last resort, I can modify XML field  values, then from the server manager I can execute a gotoactivity. In this case I would goto the convergence activity, but unless I can set that one datafield to true it will prematurely complete. I could create an xml field for each datafield, write a new set of code for the succeeding rule on this activity to set the datafields according to these values, and I'll probably do when I create the next version of the process. But this won't work for active process instances.


Long winded, I know, but I felt it was needed to fully describe the problem. Bottom line is ... does any K2 interface enable me to change the values of datafields in a running process?


Thanks,


Steve 


 


4 replies

Badge +8

Thanks, Blake.


 I'll give that a try


 


Steve

Badge +8

Blake, You Da Man!!


 It worked!


 


Thanks,


Steve

Badge +13

Is this activity just for recovery purposes?   

By "restart itself" do you mean it routes back to the beginning of workflow, or creates a new process instance with the same data that's in the current process instance?

 

"We built an activity into our workflow that gives us the capability to
change XML fields for a running process. It is in parallel to the
entire workflow, and if used will restart itself after saving the
process data."

Badge +8

Peter,


This is just a maintenance activity, and is not a part of the real workflow. And by restarting itself, I mean that it has a succeeding line that u-turns right back to itself, restarting this activity.


Our workflow has over 75 activities, and uses an Infopath form (with about 35 views) for the user interface. These processes can be active for over 2 years ... it is a Management of Change workflow for Chemicals manufacturing.


Anyway, after developing the workflow, during testing it became apparent that we needed a way to modify the Infpath XML Schema data to correct potential problems. So I created a new Infopath View that exposed every element of the XML, and then created a workflow activity (Edit MOC) that hangs off of the Start activity in parallel with the main workflow. It is an Infopath Client event that is assigned to the K2 system account. The only line coming out of this activity goes back to itself, so when this activity is used and completed, it starts again to use again if needed.


It is also handy to have if we have a workflow that completes prematurely ... meaning that when the last active task is completed it fails to move on to the next task. Without this Edit MOC task the workflow would have been completed as far as K2 was concerned and would not be able to be revied. In some of these cases I can edit the xml data using this activity, then execute a gotoactivity to send it on to the next one (that should have started). This gives me one chance to get a process instance going again.


The last client step in the workflow is connected to a system activity that uploads the form file to Sharepoint and completes the process. The linerule to that activity is "True = False", so it is never followed ... BUT ... the last event in the client activity executes a GoToActivity to this last server activity .... which expires the Edit MOC task and truly completes the process instance.


Coupled with this new K2ROM item, I can now edit any XML element or any Datafield to get a process going again. Now all I need to do is to figure out how to get an activity started without a goto so that I can keep the Edit MOC activity active.


Hope this helps ... if not I'll try to clarify further. Let me know.

Reply