Skip to main content
I have an activity which branches out to a few concurrent sub-activities, each with a different starting date.

In each of these sub-activity, when some test conditions are satisfied, the entire workflow is complete and I no longer need to wait for the other sub-activities to start. So, I tried to expire them one by one as a server event, like this:

K2.ExpireActivity("Sub-Activity 1")
K2.ExpireActivity("Sub-Activity 2")
K2.ExpireActivity("Sub-Activity 3")
...

Unfortunately, this doesn't work. The remaining sub-activities remain in waiting states. What's the proper way to stop them?
Hi,

K2.ExpireActivity() only expires the activity instance in which the event resides.

If you can supply more info on your process and what you want to achieve, there might be another way to design the process.

Regards,
CJ
Basically, I'm trying to implement a scheduler.

The main activity will set the starting times of each of the 4 sub-activities. Think of them as alarm clocks.

Each sub-activity can start provided that certain conditions are met. (eg. payment_status = 'not paid'.)

Each sub-activity may run concurrently with other sub-activities. For example, when the 2nd sub-activity is currently taking place, the 3rd activity will fire off once the starting date and condition is satified.

When payment_status = 'paid', I need to terminate all remaining sub-activities that are currently in wait states. Otherwise, I have to wait up to 40 days before K2 completes the entire workflow! (Yes, I have one sub-activity set to start 40 days later.)

Is there a better way to do this?

Initially, I tried using escalation rules, but I don't think it can satisfy the concurrency requirement.
Is is possible to email your K2 process to me at cj@k2workflow.com?
Or add it as an attachment to the post?
What was the resolution to this problem? How did you expire the other activity instances that were not completed? I am having the same issue in that once something is rejected, I would like all other concurrent, waiting activities to expire.

Thanks!
Michelle
The GotoActivity method can be used.
This method is a member of the ServerEventContext and EscalationActionContext.

How does the GotoActivity work?
The GotoActivity takes 1 parameter, namely the name of the activity it must goto.
When the method is executed, all "active" activities are expired and the activity that is specified (parameter) is started.
i am facing some problem in calling the gotoactivity...
Basically i have a workflow which will route to approver for approval, and the applicant who submit the request can recall the form at any point of time. Hence when the form is recall i will need to utilize the gotoactivity to route to another activity for processing.
But the problem is that the applicant is not one of the destination user, thus i can't open up his work list to initiate the gotoactivity.

thus i try to open up the work list item of the approver by providing the sn & approver's name so that i am able to call the gotoactivity, but seems that i can't open other ppl's worklist item other than the login applicant's or applicant's managed user work list. and bear in mind that i will not have any access to the applicant's password, thus i can't impersonate the applicant for the connection.

is there a workaround method for either gotoactivity or openworklistitem to solve my problem?
Thanks!
is there a workaround method for either gotoactivity or openworklistitem to solve my problem?


Have a look at the K2MNG.dll component - this also allows you to redirect an activity to another activity. Bear in mind that the user that creates the K2MNG connection should have 'admin' rights on the process before they will be able to redirect a process instance.

Hi NeilM,
I'm trying on the k2mng but seems like nothing happened when route to another activity.
Below are the code that i use, just a simple one to test it out.

Dim oK2Manager As New K2Mng.K2Manager
oK2Manager.GotoActivity(306, "Form Recall by Requestor")

the process instance id is still in active status when i call the gotoactivity & all user is assigned to admin, start, view & view participation rights.

Thanks!
Found the solution finally!
Missing the login part for k2manager

Solution as below:

Dim oK2Manager As New SourceCode.K2Mng.K2Manager
oK2Manager.Login(servername, port)
oK2Manager.GotoActivity(PID, ActivityName)

😃

Reply