how to get current Activity predeccor, successor, siblings and children ... etc

  • 25 October 2010
  • 2 replies
  • 0 views

Badge +2

Hi,


Are there APIs in K2 blackpearl that I can use to get the predeccor, successor, siblings, children, next and previous Activity/Activities ... etc using the current activity ID? 


Regards,


Huda


2 replies

Badge +10

What are you trying to do? 


Although not easy you might be able to derive what you want from the SourceCode.Workflow.Client.Connection.ViewProcessInstance(ProcID).


 Here is a blog using a different approach that might help you out http://blackbobo.wordpress.com/2009/08/03/silverlight-3-ria-services-based-k2-view-flow/ . 


 


Example of the return value of a simple process that has a Start and a Client Activity that loops back on itself.  Note that the client activity has multiple slots.


<?xml version="1.0" encoding="utf-16"?>
<ViewProcess>
 <Process Name="Escalation Test" Description="" />
 <Activities>
  <Activity ID="5433" Name="Start" Description="" Rect="336,16,526,56" Maximized="False" />
  <Activity ID="5434" Name="Review (cc)" Description="" Rect="336,144,526,215" Maximized="True" />
 </Activities>
 <Lines>
  <Line ID="6219" StartID="5433" FinishID="5434" Coordinates="414,56,429,123,445,190" Type="3" Lbl="" LblRect="429,99,0,0" LblOffset="15,46" LblStart="True" LblPos="True" LblStartOr="1" LblFinishOr="1" />
  <Line ID="6220" StartID="5434" FinishID="5434" Coordinates="535,176,524,147,512,118" Type="2" Lbl="Task Completed" LblRect="545,227,83,13" LblOffset="10,60" LblStart="True" LblPos="True" LblStartOr="0" LblFinishOr="1" />
 </Lines>
 <Events>
  <Event ID="10588" ActID="5434" Name="Set Serial Number" Description="" Type="1" />
  <Event ID="10589" ActID="5434" Name="ClientEvent" Description="" Type="2" />
 </Events>
 <ProcessInstance Status="2" StartDate="9/17/2008 7:11:43 AM" FinishDate="9/17/2008 7:11:43 AM" Originator="K2:DENALLIXadministrator" ProcInstID="1336" />
 <ActInsts>
  <ActInst ActID="5433" Status="4" StartDate="9/17/2008 7:11:43 AM" FinishDate="9/17/2008 7:11:43 AM" ActInstID="2" ActName="Start" />
  <ActInst ActID="5434" Status="2" StartDate="9/17/2008 7:11:44 AM" FinishDate="9/17/2008 7:11:44 AM" ActInstID="5" ActName="Review (cc)" />
 </ActInsts>
 <LineInsts>
  <LineInst LineID="6219" StartActInstID="2" FinishActInstID="0" Result="1" LineInstID="4" LineName="DefaultLine" />
 </LineInsts>
 <EventInsts>
  <EventInst EventID="10588" Status="3" EventInstID="29" EventName="Set Serial Number" ActName="Review (cc)" />
  <EventInst EventID="10589" Status="1" EventInstID="33" EventName="ClientEvent" ActName="Review (cc)" />
  <EventInst EventID="10588" Status="3" EventInstID="30" EventName="Set Serial Number" ActName="Review (cc)" />
  <EventInst EventID="10589" Status="1" EventInstID="34" EventName="ClientEvent" ActName="Review (cc)" />
  <EventInst EventID="10588" Status="3" EventInstID="31" EventName="Set Serial Number" ActName="Review (cc)" />
  <EventInst EventID="10589" Status="1" EventInstID="35" EventName="ClientEvent" ActName="Review (cc)" />
  <EventInst EventID="10588" Status="3" EventInstID="32" EventName="Set Serial Number" ActName="Review (cc)" />
  <EventInst EventID="10589" Status="1" EventInstID="36" EventName="ClientEvent" ActName="Review (cc)" />
 </EventInsts>
</ViewProcess>

Badge +2

Hi


In my case I want to get the children of specific activity using Activity Instance ID


 


Suppose I have a process and I started process instance from this process and I have the following in my process:


1.       Activity 1 have two children Activity 2 and Activity 3


2.       Activity 2 have two children Activity 4 and Activity 5


 


Suppose that I have the Activity instance ID for Activity 1 I need to get the children for this activity


Which are in my example above (Activity 2 and Activity 3)


 


also please advice how to get the previous (parent) activity as well as children activity like if I have


the Activity Instance ID for Activity 2 I should get Activity 1 as its parent.


 


Thank you


13160i0C38963F5FB293B4.png

Reply