Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.

Save money and spend more time on priority work.

Book consultation

Let's choose, design and deploy a process automation solution for your business.

Find out more

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation

Automate where it matters most. Scale to solve challenges in every area

Find out more

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
15 October 2015

Creating K2 SmartObjects with one to many, or many to many associations

We will make use of an example where different line of businesses can have multiple products in each line of business. In other words one line of business has many products, but a product can only be associated with one line of business, as depicted in the diagram below.

K2 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.


Free K2 Five Upgrade Review

1 - SmartObjects Associations

1 – SmartObjects Associations

In this example we will create two SmartObjects and then add an association between the two objects. We have started off by creating the following two tables in the database:

2 - Database Relationship

2 – Database Relationship

We already created the LOB SmartObject, giving it the usual default properties and methods. The next step is to create the product smartobject, and configure its association to the LOB smartobject. We will briefly step through the steps required to accomplish this below.

1. Right-click on a category and select ‘New smartobject’. This will open SmartObject Designer wizard.
2. Click on next to skip the first step of the wizard (Introduction).

3 - Creating a SmartObject in K2

3 – Creating a SmartObject in K2

3. In the general tab specify a name for your smartobject, select Advanced SmartObject, and press next

4 - Adding SmartObject Methos

4 – Adding SmartObject Methos

4. Select the Methods Tab and press Add.

5 - Adding a Service Object Method

5 – Adding a Service Object Method

5. Select the Product table and press next.

6 - Auto Map Service Object Methods

6 – Auto Map Service Object Methods

6. Press Create All to create all the default properties, and press finish.

7 - Create Association 1

7 – Create Association 1

7. The next step is to define the association with the LOB smartobject. Press next, add, then select the LOB SmartObject from the list.

8 - Create Association 2

8 – Create Association 2

8. Now configure the one to many relationship.

9 - Choosing an association mapping

9 – Choosing an association mapping

9. And finally define the key for this relationship.
10. The highlighted section of thefollowing screenshot indicates that the relationship between the two smartobjects has been correctly defined.

10 - Association Setup Done

10 – Association Setup Done

Now that our SmartObjects have been created we can go ahead and use this association to easily create dropdowns, as we will discuss in a future article.

Need further technical advice or support?