K2 SmartForms

Creating comboboxes from K2 SmartObjects with associations

Comboboxes from k2 Smartobjects

In a previous blog post we explored how to create various relationships between your SmartObject entities. In this post we will expand on the usefulness of having defined these associations in the first place.

Lets just look at our basic data setup again before we continue. Basically a product is associated with a specific Line of business, while a line of business can be associated with many products.
comboboxes from k2 smartobjects - 1

Now we would like to create a screen from where we would like to add a new product to the system. To do this we have to choose a line of business to which the product needs to be added. The basic screen layout is as follows.
comboboxes from k2 smartobjects - 2

To get the combobox on this screen to display database driven data, you usually would have had to perform a few steps, as listed below.

1. Drag a combobox control onto the designer.

2. In the data source section of the combo box properties define the data source as follows:
comboboxes from k2 smartobjects - 3

3. Make sure the the following rule is added to ‘When the view executed Initialize’.
comboboxes from k2 smartobjects - 4

If you have however already configured the association between the LOB and product Smart Objects it however becomes as simple as dragging the LobId field from the right hand side ‘Fields’ tab onto the design canvas and all the rules and setup will automatically be performed for you.

This become especially usefull when creating list views with editable combobox fields. The more times you use the field, the more time it saves if you just define the associations correctly from the get go.

Comboboxes from k2 Smartobjects

You may also like

Leave a comment

PODCAST  |  Why you need to establish a K2 Center of Excellence today

Interview with Arno van Rooyen, CEO, Velocity