Tuesday 5 June 2012


In this post I’ll step you through the setup of configuring a filter on a GetList, using a comma-delimited list as the input value for the filter… well, so to speak. Currently K2 smartforms does not support the above mentioned principle, but there is an easy enough way to work around this issue.

First off is our backend. I’ll be using the following SmartObject setup (for simplicity sake):


In this scenario, all three SmartObjects are standard SmartBox SmartObjects, each with its normal CRUD and default List method.

Next up, we’ll need to extend our “Subject” SmO with an additional List method. For this we’ll need the .SODX of the SmartObject, which we can get from the ‘SmartObject Services Tester’ tool:


We’ll extend the SmartObject using K2Studio, as such, open up K2Studio, create a new project and add the .SODX file to your new project. Next, select to create a new Method, and check the option to run the wizard in “Advanced” mode:


Provide the method with a Name, and select the “List method” type:


Add a new Parameter which will be used to capture the ID of your Student:


Next we want to bind our ServiceObject Methods. For this example, we’ll use the GetList methods of the “Course” and “Subject” SmartObjects:


For the “Subject” SmartObject, we’ll auto-map the required SmartObject fields, and for the “Course” SmartObject, we’ll select to auto-create these:


Keep in mind however, that for the GetList method of the “Course” SmartObject we need to bind our custom Input Parameter to the Student_ID_ForeignKey in our table:


Continuing with the wizard, we now have to configure our Service Join on the two ServiceObject methods. For this we’ll use both the above configure methods, starting with the GetList method of “Course”, and doing a join on the Course_ID_ForeignKey and Course_IF_PrimaryKey respectively:


All that’s left to do in K2Studio is to finish the wizard, and re-deploy out SmartObject back to the server. Once this has been done, we can continue back to the K2 smartforms designer. Once there, create a new List View, using the “Subject” SmartObject as the data source of the View.

In the “List method” dropdown, select the above created method, and deselect the “Call this method when the form loads” option. Select to generate the layout of the View with the required fields, and continue to the LayoutPage. On the LayoutPage add a [ToolbarButton] and a [Textbox] control to the toolbar area of the View, and then continue to the RulesPage.

Add a new Rule to execute your custom method:


And then map the [Textbox] control to your Input Parameter:



[Runtime test data]