Skip to main content

Hi people, I need your help... I'm trying to remove or expire an activity inside another activity. I need a way to do this without using the GoTo escalation. Server Event K2.ExpireActivity("MyActivity") only works for the activity where the event is.


I tried the following snippet I found in the K2.net Help, but I got a compilation error saying: "'Remove' is not a member of 'SourceCode.KO.Activities'."


'Assume that you have an Instantiated
'K2Studio.Process Object
MyK2Activities = MyK2Process.Activities
MyK2Activities.Remove("MyK2Activity 2"))


Any ideas, suggestions and comments on how to do this are welcome, thanks in advance!


Monica

The thing is that I do have a parallel path. If the process starts activity 'A' I want to remove the activity 'B' and continue with 'A' events... Is this possible somehow?


Thanks Blake for your quick response!


 Monica


GotoActivity will not work if he has more than 1 parallel route (A, B, and C)...

 Mirk can you describe the business process of this parallel route?


 


U can use a Goto escalation and edit the code to call a webservice that expire the activity B
 


Hi guys, basically I have an approval activity "Approval" with several levels of approval. If the first level is completed and some conditions are met, a different approval activity "CTD" is started and the "Approval" activity continues.


If one of the remaining approvers in "Approval" rejects the document, the "Resubmit" activity begins and the "CTD" activity needs to be removed or expired.


I tried with the GoTo Escalation (and it works) but it would have to be checking every second or minute to see if someone rejects the document, so my boss didn't like that idea.


I've been trying with the GotoActivity but I'm probably using it the wrong way cause I end up with two "Resubmit" activities.


Suggestions?


Thanks,


Monica


Isn't your "Resubmit" activity before the "Approval" activity?   GotoActivity should expire all other ones and just go to "Resubmit" activity.  

When you say you end up with 2 Resubmit, you mean you have 2 of them in the process designer or workitem?
 


Yeah, Resubmit is before Approval.


The two Resubmit in the Worklist. In Resubmit I have a Default Server event (where I use the GotoActivity), a SQL Data event and an InfoPath Form event. According to my testings, the execution order is like this:


Default Server event (Condition to do the GotoActivity = True)
  Default Server event (Condition to do the GotoActivity = False)
  SQL Data event
  InfoPath Form event
SQL Data event
InfoPath Form event

I might be doing something wrong...


Hi mirk579,

Can u please post a screen shot of the process. 


Sure, I just attached the screen shot


Why would you call GotoActivity from your Resubmit?   Wouldn't it just flow back to InfoPath Initialize automatically using the line?    You'd only call GotoActivity from a server event that checks for REJECT action that is placed after the client event of each Approval activity.

You're totally right, you've opened my eyes and made me realize what I was doing wrong. That intermediate activity did the trick.


Thanks a lot for all your comments guys!


Reply