K2 worklists are key in any K2 Workflow application, and, a direct link from the K2 worklist to specific data in custom application databases do not always exist. As performance plays a big role, it is always important to load data as efficiently as possible.
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.
In this example we will look at a scenario where we create our own custom worklist (displayed to the user) made up of both details from the K2 worklist and a custom application database. In the K2 worklist we store the username of the allocated user, however in our custom database we have a user table containing all the user details – but no direct link between the two.
To display a friendly name instead of the username, we need to use the worklist data to search our custom user table. When we have thousands of tasks it becomes very inefficient to do a lookup to the user table for every single task, same goes for fetching details from AD separately for each single task.
A very simple and efficient solution is to use a dropdown in the K2 SmartForm ListView, causing the user data to only load once and then displays the correct friendly name based on the K2 worklist data.
You can set up the dropdown to use a SmartObject returning a list method. Make sure you set the value to the property that will match the data returned from the K2 worklist, in this case the user’s FQN.
Choose from the SmartObject which properties you want to be displayed and make sure the dropdown settings allow empty select to cater for null values (otherwise the first record in the dropdown will automatically be displayed).
When you run your application you will see the list displaying a friendly name for the allocated user (from our custom database) instead of just the username (from the K2 worklist). You will also notice the data does not display the actual dropdown control but only the display label. If you change your list to an editable list the dropdown will display in the add / edit row.
This is a really quick and easy way to “combine” data with no link, with the added bonus of not having a negative impact on your performance.