Infopath Client Event - Display Previous Comments

  • 9 April 2008
  • 2 replies
  • 0 views

Badge +9

I am trying to build one of my first actual business processes, so bear with me if this is a very simple request.

The process is basically an approval process with at least 4 levels of approval (there may be more, depending on if any changes are requested during the flow)

One of the requests is that the users always be able to see the comments/status from each of the previous approvers - this is what I am not sure how to implement.

My current thinking is to use a single infopath form which will open in the browser for each approval step. Each approver would be presented with the same form, with the approval options and a comments section at the top and underneath there would be a repeating table which showed who had previously approved/commented and the approval status and comments that they entered.

Firstly, does this sound like I am taking the right approach, or is there a better (simpler?) way of doing this?
If this approach sounds reasonable, how do I insert additional rows into the repeating table of the form as each step is completed? Can I do this from within K2 (preferable) or do I have to do this in Infopath (I think this would require infopath code to achieve it - can't be done via rules?)

Hopefully this makes sense, and somebody can give me some feedback here to make sure I am heading in the right direction. If any more information is required, please let me know.

Thanks in advance for any assistance.


2 replies

Badge +8

Hi arduk,


You're on the right way to achieve what you want. Your vision of the form looks right to me, and I confirm that adding a row to your repeating table can be done in K2 server events.


What you have to do, in terms of workflow, is adding a loop, i.e. an arrow going from your review activity to itself (with rules on the arrow line, in order to loop until every reviewers have seen the form).


In this review activity, you only have to play with the XML data of your form (using System.Xml) with the help of a custom server event. Basically, if you have <my:table><my:username/><my:usercomments/></my:table> corresponding to your repeating table, adding the exact same group of nodes just after this one will add a row to the table in the form.


The only thing you have to be aware of is that you must modify the XML data of the K2.ActivityInstanceDestination, and not the K2ProcessInstance (otherwise you would loose your changes after each loop).

Badge +9

Hi Nicolas - thanks very much for the assistance - very good to know that I am heading down the right track!

any chance of you having some sample code on how to do this?


Also, if you could let me know the best place to add the code it would be great (eg should this be done in the succeeding rule?).

So far I haven't used any code in a K2 workflow, so am still getting my head around where it should be put in order to achieve what I need to do.

Thanks in advance - I really appreciate you taking the time to help me out!!!

Reply