Activity Destination Users based upon a Repeating XML element

One of the lesser known new features of the expanded Destination Rule functionality of K2 blackpearl is the ability to very easily base Destination Users from a repeating XML node that contains a User ID. In K2 2003 this required a bit of coding in the Destination Rule for each Activity for which you wished to do something like this. With K2 blackpearl this is now a drag and drop experience in the process design canvas.  This can be a very useful feature in a schema driven process development effort.

In this example I will show how an InfoPath form can be leveraged to capture a list of users that will then become the basis for the next step’s Destination Rule.

1. Create an InfoPath form and InfoPath integrated K2 process as normal.

2. Design the form as per normal.

3. Add a new repeating Text (string) element to the Main data source (in this example I’ve named the field “Reviewers”)

clip_image002[8]

4. I then drag out the repeating text field onto the desired InfoPath view:

clip_image004[19]

5. In this example I did the following:

  • a. Selected “Repeating Table” when prompted
  • b. Changed the text box to a Drop Down List
  • c. Added following content to the Drop Down List to allow users to select reviewers from an easily readable drop down list (with actual Domain\userID as the hidden value):

clip_image006[8]

6. Save and close the InfoPath form.

7. You should now be back at the Process design canvas and see the following message:

clip_image008[8]

8. Click OK and then Finish

9. In this example, I then want to change the destination rule for the desired activity:

clip_image010[8]

10. With the Destination Rule window open Navigate to the Destination Users window:

clip_image012[8]

11. Click the Add button

12. Click the ellipse (“…”)button

13. Navigate to the Process/Activity Data tab within the Context Browser then expand the XML Fields node until you find the “Reviewers” node.

14. Either drag and drop the Reviewers node or select and click the Add button.

clip_image014[8]

15. Once this has been selected it should look like:

clip_image016[8]

Now if we deploy the process and then open the form we can select multiple users:

clip_image018[8]

When the process hits the Destination we setup it will create task rights for each user that appears in that reviewer repeating section. If we review the Out of the Box “Activity Instance Destinations Report” for this instance we can see that the three users we selected in the InfoPath form are now destination users for this activity.

clip_image020[8]


Posted Thu, May 22 2008 2:14 PM by Bob

Comments

gonemad wrote re: Activity Destination Users based upon a Repeating XML element
on Wed, Jul 23 2008 10:59 PM

When was this functionality added?  Previous versions of black pearl still required a bit of coding to read the repeating field properly, other wise it would only use the first node and ignore the rest

Bob wrote re: Activity Destination Users based upon a Repeating XML element
on Wed, Aug 27 2008 6:23 AM

I believe this functionality has existed since RTM.  I don't recall ever having to write code in blackpearl to do this scenario.  K2.net 2003 is a different story... this definately requried code in the process defintion.

johnny wrote re: Activity Destination Users based upon a Repeating XML element
on Fri, May 29 2009 9:17 AM

I actually did a demo around this to a class of trainees. I discovered that one of the cool things you can do with the new ADService2 in 0807 is that you can wrap a SmartObject around it and execute a GetUsers call from here.

The nice thing is that the new ADService2 returns both the <domain>\<userid> and <userid> fields.

So you can actually do a quick bind to the drop down list using a SmartObject wrapped around the ADService2 and return a list of users inside.  You can bind the <domain>\<userid> to the data value and <userid> to the display value.  The destination rules will then recognize the user based on the <domain>\<userid> format.

The other cool thing is that you can pass in other parameters from your form to do filtered lists of users by passing in parameters into the calls (e.g. OU).

I did this demo in less than 5 mins.  Neat.