The below example was recently worked up and provides good insight into a little know feature. It has also been added to the updated version of the K2 blackpearl Roles and Advanced Destination Rules document.
A repeating XML node or SmartObject GetList method can be leveraged to kick off an unknown number of IPC events, each with data is mapped to the target process in a Process data field.
The following example illustrates this with a repeating section of an XML field..
Step 1. Create a repeating XML doc that looks something like the following.
<OrderXML>
<Order>Order1312</Order>
<Order>Order2412</Order>
<Order>Order3412</Order>
<Order>Order4531</Order>
<Order>Order5751</Order>
</OrderXML>
Step 2. Create a process-level XML data field with the above schema (called IPCXML in this example).
Step 3. Add a Default Activity to the design canvas and go to the Advanced Destination Rules.
Step 4. Select “Plan Per Slot (No Destinations)”
Step 5. Use the “Select a list field to determine how many slots should be created” option and point it to the repeating node in your XML schema, and then finish the wizard. This option will repeat through the XML schema and start a new IPC for each node entry. This data can be used as initialization data for the child process
Step 6. Drop an IPC Event on the activity. On the Field Mapping page map a data field in your child process to the ActivityInstanceDestInstanceData. K2 Server takes the repeating XML node’s value (at runtime it is stored in the InstanceData) and copies it into the data field in the child process (in the example called "IData).
The parent process starts a new IPC process for every repeating node entry and passes the XML node value to the data field in the child process. In this example it starts 5 child processes via IPC and each instance has a process data field containing a unique order number.
Posted
Wed, Oct 22 2008 3:57 PM
by
Bob