Let’s say you have a workflow process that identifies multiple users via a SmartObject method, and those users will each become the destination users for a second process. I’m going to show how to successfully configure the inter-process call (IPC) using destination rules and Activity Destination Instance Data.
We’ll do this in three steps. The first step is to configure the Activity Destination User; the second is to expose that configuration inside the call. The final step is in configuring a succeeding rule on the activity.
Step 1: Configure the Activity Destination User
Open the General Properties of the K2 Activity that holds the IPC Event. Using the left-hand navigation, select the Destination User configuration.
Once on the Destination User panel, click the Back button to get to the start of the wizard, and check the Advanced box. Now click Next to reveal the destination rule options panel.
In the options, select Plan per slot (no destinations), then click Next.
In the next panel, click the Select a list field to determine how many slots should be created radio button, and the field should point to the List() method of your SmartObject, returning your list. Click Next.
On the List Options panel, ensure you have the object return all results by selecting the Return all results that match filter radio button.
Step 2: Configure the IPC Event
Enter the send field mappings for the IPC event. Scroll the list until you reach the field for your user IDs. Open the Workflow Context Browser and drag over the Instance Data field, located within the Activity Destination Instance node.
The rationale here is that Plan per Slot basically deals with data (a list of something — it doesn’t care what the list represents). The ActivityInstanceDestinationInstanceData field (this is how the Activity Data field appears in the mapping) tracks the current item within the list of user IDs returned by the SmartObject.
Step 3: Configure the Activity Succeeding Rule
The succeeding rule must be configured on the activity containing the IPC event, such that the parent workflow does not leave the activity before all of the calls have been made.
Use the Status field from the Activity Destination Instance node in the Workflow Context Browser (the same browser and node where the Activity Data field came from). Configure the rule so that the process instance cannot succeed the activity unless the status equals “Completed.”