How to use InfoPath repeating tables with K2?

  • 11 April 2011
  • 7 replies
  • 3 views

Badge +3

Hello All,


Sure this is going to be an easy one, I have a paralle approval within my k2 workflow for about 5 users, what I would like to achieve is the following:


A IP repeating table that takes the name, date & dept for each user and allows them to put an approval status (based on the outcomes within the workflow) and a comment.


What I want, is the first person's response to fill in the blank line, then for the next to have a line when they access it and enter their information, etc etc.. So at the end you have a repeating table with multiple entries all with the results from the approval.


However, I have no idea where to start! Your help would be most appreciated!!


Kind Regards,
Dayna


7 replies

Badge +10

Hi Dayna,


I suggest you use a SmartObject to store your comments for each user. Integrate the Create and GetList methods into your InfoPath form from the InfoPath Integration Wizard in your workflow.


In InfoPath, drop the fields from the Input properties of the Create data connection onto the form to allow the user to complete their comments and approval. On the form submit call the create data connection.


For the listing of the previous comments, drop a repeating table with all the fields from the GetList data conneciton onto the form. To ensure you only display the comments for the current process, I would create an extra field in the SmartObject to accept the Process Instance ID. On your InfoPath form load, set the GetList's input field which stores the Process Instance ID to the current Process Instance ID (This is exposed under the _K2 node) and then call the GetList data connection. In this way the previous comments for this process will be displayed when a user opens the form and it will allow a user to add their own comments.


I hope this helped you!


Regards,


JohanL

Badge +3

Hello JohanL,


Many thanks for your reply! I must admit, I've very new to K2 and even more so to SmartObjects but I'll certainly give it a go!


How do I link the data from the IP data connection to the SmartObject?


Kind Regards,
Dayna

Badge +10

Hi Dayna,


The first step is to use the InfoPath Integration Wizard in the K2 workflow to link the SmartObject methods to the form. This you can do through the pink icon on the Process Toolbar (Top right corner). On the Workflow Templates screen click the Edit button to add the Create and GetList methods. After integrating them you can use the Design button from this window to edit the InfoPath form.


You link your InfoPath data source to the SmartObjects by setting the values of the InputProperties of the SmartObject Data Source. This you do on the InfoPath rules. Use the Set a field's value action and specify the property by selecting the SmartObject method from the data sources and then drilling down through the queryFields, all the way to the InputProperties of the SmartObject method. Assign this value by either typing something into it or dragging an InfoPath field (from the Main Data Source) into the window. Once the Input properties have been configured, in another Action call the Query using Data Connection action specifying the SmartObject Data Source.


When the rule is executed, it will set the input properties and execute the SmartObject method and the result would be that a new record is created with the properties you specified (in the case of the Create method) or that the return properties are filtered (in the case of the GetList method).


I hope this made sense.


Let me know if you need further information.


Regards,

Badge +1

Hi Johanl,


I have infopath form with repeating table, i want to store each record in repeating table in one row in database using smartObject with codeless.


please i need your help.


Best Regards,


Omar


 

Badge +10

Hi Omar,


Follow the same principles as above, but simply configure your SmartObject to use the Dynamic SQL Service Instance which you configure to connect to your database. There are instructions on how to configure the SQL Service in the documentation. The way you connect it in InfoPath is exactly the same, only the SmartObject changes.


Regards,

Badge +3

Hello JohanL,


Your response makes perfect sense, and I'm sure this is a very newbie question, I'm currently doing:


"On the Workflow Templates screen click the Edit button to add the Create and GetList methods. After integrating them you can use the Design button from this window to edit the InfoPath form."


So I'm on the screen 'SmartObject Intergration', and selected to add a SmartObject method, but where do I get the create and getlist fields? I thought they'd be in the SmartObject Server(s) within context browser. Or do I have to create these methods first?


(Yes, I know, my SmartObject skills so far, are, well.. none existent!)


Many thanks for all your help.


Kind Regards,
Dayna


 

Badge +10

Hi Dayna,


You have to first create these SmartObjects and deploy them to the K2 Server before they will appear under the SmartObject Server. So what you are doing in the InfoPath Integration wizard is correct, but you first need to add a new item to your project, select SmartObject, populate it with the properties you need, deploy it and thereafter return to the InfoPath Integration wizard.


Here are a couple of useful links to get you started on SmartObjects (Provided you have a portal username and password):


http://help.k2.com/helppages/k2blackpearl1290/SmartObject_Integration.html (Principles apply to K2 for Visual Studio as well)


http://help.k2.com/helppages/k2blackpearl1290/Reference_-_Deploying_a_SmartObject.html


http://help.k2.com/en/displaycontent.aspx?id=1703


Let me know if you require any further help.


Regards,

Reply