Thursday, April 14, 2011

K2 Destination User for Plan Just Once Activity


In your K2 process you may want to know who actioned a workflow item so that you can save the user information to a SharePoint list or display it on your user interface in a later step. However, when you have a destination rule for an activity that is Plan Just Once you are unable to retrieve the destination user from the User object in the Activity Destination Instance node in the Workflow Context Browser.



To retrieve the destination user for a Plan Just Once activity you can use a SmartObject Event to call the Activity Instance Destination List method. Add the SmartObject Event directly under your client event in the same activity as the client event. In the screenshot below the SmartObject Event is the Save Destination User event.



In the SmartObject Event select the List method under the Activity Instance Destination SmartObject as shown in the tree below:



On the next screen drag over the Activity Instance ID field to the Activity Instance ID input variable:



On the Return Mapping screen map the Destination variable to a process data field:



Finish the SmartObject wizard.

Finally, ensure that your process has a SmartObject Association with the Workflow Reporting SmartObjects. To do this, launch the SmartObject Association Wizard (in Visual Studio the button to launch the wizard will look like the first screenshot below) and check the Create Workflow Reporting SmartObjects checkbox.



Now you have your destination user available in a process data field to user at a later step in your workflow.

No comments:

Post a Comment