Skip to main content

Hello,


I have an approval infopath form and directly after this form event I like to update a smartobject (within the same activity) putting in the destination user. The activity has a role for the destination user - so I like to find which person has currently approved.


Is there a K2 field which I can use?

I would suggest you build a field into your infopath form that captures the approval user. So you can use an InfoPath rule to populate the field with the currently logged on user and maybe set the rule for on-submit. Then you can use that field in the rest of your process.


Cheers,


 


Of cource this will work - but ...


what's about Activity Destination Instance -



  • how long are this fields accessable (before / after the Client Event)
  • what values contains the User field group within this instance

Do you know what type of activity Destination Rule you are using:  a 'Plan just once' (which is the default) or the 'Plan per Destination' (which is only availabile via the Advanced mode of the destination rule).


If you are using the default Plan just once, the underlying User object of the Activity Destination Instance is not usable (it doesn't have any context).  If this is the case you'll need to write code in a server event to find who actioned it.  Below is a code sample that will show all the people assigned an activity and the status of their actions.  This isn't exactly what you'd need to do but hopefully it can accelerate you:


for (int i = 0; i < K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots.Count; i++)
{
 string strAction = K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots.DataFieldsi"ActionResult"].Value.ToString());
 string strUser = K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots.User.Name.ToString());
}


If you are using the 'Plan per destination' option, then the User object of the Activity Instance Destination is usable either from code within a Server Event or from the K2 Conext Browser ('Activity Instance Destination' node on the last tab); which would allow you to map the desired user properties to something like input properties of the SmartObject event.


HTH.


Thx Bob - this is a detailed explaination.

Reply