Get User who finished an Infopath Client Event

  • 23 February 2008
  • 3 replies
  • 0 views

Badge +5

Hi,


I have a K2 process using some Infopath forms through Infopath client events dispersed in several activities of my process.


I need to know the user that fills and submits each of those forms after each infopath client event is executed. I could use an hidden textbox on the forms with function Username() as default value but i believe that would imply setting the security to Full Trust and that is not required just for this.


Not going this way, how can i obtain this info in K2?


Thanks


3 replies

Badge +9

jarrostick,


If you "Plan per destination - all at once" within the K2 activity, then you can capture the user in a Server Event placed after the InfoPath Client Event (i.e. in the same activity), as the Server Event will have the destination user context then.


There is some discussion around "Plan per destination" here http://k2underground.com/forums/thread/19696.aspx

Badge +5

Bob thanks for your reply,


Even if the destination users of the activity are 2 or 3 different users, meaning that all of them have the task on their worklist, i can get the username of the one that actually opens the form related to the infopath client event and submits it?


My idea of choosing "Plan per destination - all at once" is that parallel processing is "enabled" and so the server creates one activity instance per destination. If i have 3 destination users i will get 3 activity instance destinations, right?


i was in fact looking at the K2.ActivityInstanceDestination.User class and thinking on doing something like:


String

formUser = K2.ActivityInstanceDestination.User.Name;


My doubt is how will this work to achieve my goal if 3 destination users and so 3 activity instances are created. Will the above line of code give in fact the user that submit the form regardless of this?


Thanks again

Badge +9

jarrostick,


If you have 3 destination users and you use "Plan per destination - all at once" then yes, there will be 3 individual copies of the activity instance (called ActivityInstanceDestination) created at the same time, one assigned to each user.


If you used the code you mention above (User.Name) in a server event after the InfoPath client event, then yes, that should be the destination user who finished the form as that Server event would be executing within the specific destination users copy of the activity instance (ActivityInstanceDestination).


HTH.

Reply