Skip to main content

Hi,

 

I have a ASP.NET Page as a form where the user can select different task and assign each task to a person. Based on this I start a K2 (Blackpearl) workflow. 

Now I would like to start for each selected task(and the associated person) a seperate workflow with asyncronous IPC so that each task is assigned to a user in a subprocess. The problem is that I don't know how to get K2 to start "N" IPCs depending on how many items I have in the list. Is there any other way to do so, or a part of code where I could surround the start of the IPC process with a "foreach"?

 

Thanks,

Matt

I just did something similar to this.  What I did was a creates a few datafields to store the details of the process being started.  Then in one activity read how many items need to be processed and store it to a data field (and anything else you may need in every loop).


Then in the next activity, use a server code event and read the first item(s) into the data fields you created, then execute the IPC event using the datafields as inputs.  then direct a line rule to an activity that decrements your counters and use another line rule to direct it back to the Server code / IPC event.  When the counters decrement to 0 (or pointer = count, whatever works for you), the rules will break the loop.


blackpearl supports a concept similar to a foreach without writing code.  You should be able to use a concept similar to the following:


http://www.k2underground.com/blogs/fromthebench/archive/2008/10/22/using-a-repeating-xml-node-to-start-child-ipcs.aspx


You can do this not only with repeating XML nodes, but also a SmartObject list.  You can also use this technique with events other than IPCs.


David


David,


 Good to know! Thanks!


Thanks!

This was exactly what I was looking for. I already tried to implement the solution with the XML. Somehow it does not work. I tried to exectly reproduce it like described. But it does not work. It starts only one IPC process.

Any idea?

Here my XML and XSD:

<Users xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <User>Test1</User>
  <User>User2</User>
  <User>User3</User>
  <User>User4</User>
  <User>User5</User>
</Users>

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Users">
<xs:complexType>
<xs:sequence>
<xs:element ref="User" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="User" type="xs:string"/>
</xs:schema>

Thanks,

Matt


David, some of the options do not seem to be the same on the activity level. was this changed for 8.07?


I am wishing to create a dynamic number of sharepoint groups based on the count of nodes in an xml document. However, I am unable to drag in an xml field into the appropriate area. Does the list field need to be formatted in a particular way?


 


Regards.


did you ever figure this out, I would guess its something to do with your xml?

Reply