Skip to main content
Hi all,

In my current workflow I assign an activity to 3 groups with 1 active slot. I just use plan once. When the activity has been completed by one of the users I want to know who actually performed the action.

How can this be done. Do I need to use the API or can some field be used?

Hi,


The easiest option is to store the person's name / ID in a data field. Alternatively you can query the reporting smartobjects.


Cheers


 


I tried to fill a datafield with the activitydestinationinstance.user.fqn but that returns the server account instead of the username.

Using the activitydestinationinstance.user.fqn will work however, you have to change the destination user default settings for that activity.  Go into Destination Users Advanced mode (click on back and check off Advanced)and choose to change the Destination Rules Option from Plan just once to All at Once and on the next screen choose to Resolve all roles to users. 


Note that there are some tradeoffs of using this approach and its not recommended if you're activity is assigned to a role or group with a lot of users.  Especially if that activity has heavy data needs like its an InfoPath activity.  This can affect the performance and scalability of the K2 Server under load and because of data auditings it can quickly fill up the K2Log database.  With that being said if its an activity that is assigned to a few users it shouldn't be an issue.


Here is a whitepaper that discusses the destination options and roles.  There is more to it than most people realize.  The section that deals with this specific topic is on page 7:  http://k2underground.com/files/folders/technical_product_documents/entry20948.aspx 


 


I hope this helps.


Tim


 __________________________


Principal - Technologist


Caprivi Solutions Inc.


 


            for (int iLoopCount = 0; iLoopCount < K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots.Count; iLoopCount++)


            {


                if (K2.ActivityInstanceDestination.ActivityInstance.WorklistSlotsniLoopCount].DataFields."Action Result"].Value.ToString() == "Approved")


                {


                    K2.ProcessInstance.DataFieldsa"User Who approved"].Value = K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots]iLoopCount].User.FQN.ToString();


}


}


 


use this code but configure your activity as plan all at once


Since you're using plan just once and one slot, you can get at this with a single line of code.  If you put a server event immediately following the client event (in the same activity) you should be able to find the user Id of the identity that filled the slot with the following:

 

            K2.ProcessInstance.DataFieldsc"Name"].Value = K2.ActivityInstanceDestination.ActivityInstance.WorklistSlotsW0].User.FQN;
 


Reply