Go to multiple activities at the same time programmatically

  • 3 October 2005
  • 4 replies
  • 2 views

Badge +2
Hi there,

I'm wondering how it could be solved to go to multiple activities in a process instance at the same time programmatically. I mean parallel activities that should run at the same time, as you see on the attached image. The goal to achieve is to make both Default2 and Default3 activity active (there are no line rules so those should run at the same time).
I tried to use GotoActivity but it didn't solve the problem. Either it made Default2 active and Default3 inactive or made it reverse but never made both active at the same time.
Suggestions needed, please help how to achieve this.

Thanks in advance,
Peter

4 replies

Badge +11
As far as I know, it can not be done programatically. You'll have to instantiate the previous Activity (named 'Default' in your schematic) and either finish the client event programatically or wait for the user to finish it in order for the line rules to be evaluated and the process flow to continue.

Regards,
Ockert
Badge +9
Hi,

Please have a look at Module 05 : Intermediate Workflow design using K2.net 2003 of the training material. This module discusses the use of the various Activity rules in K2.net. Specifically have a look at the Preceding rule section on page 8. You can download the training material from: http://portal.k2workflow.com/downloads/training.aspx
Badge +2
Hi Ockert,

I tried what you suggested but I'm afraid I don't understand it.
I made 'Default' activity active with GotoActivity, and I called then Finish(). Events are now finished, but the flow doesn't move on to the next activity. Should it?


// find proper worklist item and then...
workListItem.GotoActivity("Default");
workListItem.Finish();


Peter
Badge +11
No, I think your problem lies with the worklistitem object. I assume you use K2ROM to create and start a new process instance. K2.net Server will immediately instantiate the process, the 'Default' Activity as well as the Default Client event contained within the Activity. At this point the client event will have its own unique serial number. Now you use 'GotoActivity' which will expire the current 'Default' Activity and instantiate a new 'Default' Activity with a new client event and a NEW serial number. So, the current worklistitem object you're working with does not exist any more and can not be finished. You would probably have to find the new worklistitem before continuing.

Hope this makes sense,
Ockert

Reply