Welcome to K2 Underground Sign In | Join | Help
How To Add Code in a Default Escalation

I was asked today how to add code into a Default escalation. At first glance it doesn’t appear that there is anywhere to insert your code, because when you view the code you are shown an empty XOML.  However, it is entirely possible if you drag out a WF ‘Code’ activity onto the XOML canvas then double click it to generate the method stub.  At that you’ll be looking at the C# code.  The K2 context object has already been created for you so you should be able to code as normal.

 

You can use this technique in similar situations like when editing the process Start and Stop rules (or anywhere you are presented with a blank XOML canvas).

 

Below are the steps to reproduce and execute this.

 

1.       Add Escalation

2.       Give it a name/description

3.       Select Escalate After / Escalate On

4.       Configure the rule (when the escalation will fire)

5.       Set working hours (if required)

6.       Select ‘Default’

7.       Select Finished

8.       Select the escalation you just created and click little down arrow/triangle next to ‘View Code’  button and select ‘View Action Code’

9.       When you see the xoml, open the VS toolbox

10.   Drag a ‘Code’ activity from the Windows Workflow toolbox, drop it on the “Drop activities here” box

 

11.       double click ‘codeActivity1’

12.       You should now see a method stub for ‘codeActivity1_ExecuteCode’

13.       Add something here like:

                               K2.ProcessInstance.DataFields["Title"].Value = "SET IN ESCALATION";

 

 

 

 

Published Friday, April 04, 2008 7:44 PM by Bob

Comments

No Comments

Anonymous comments are disabled
Powered by Community Server (Commercial Edition), by Telligent Systems