K2 interacts with data sources using a very powerful technology called SmartObjects. A SmartObject is used by K2 to expose data from variety of data sources to K2 SmartForms, K2 SmartForm Views and K2 Workflow Processes.
Using the K2 SmartObject Tester, we can easily generate SmartObjects from SQL Server, SharePoint, Web Services, Active Directory or any other data source.
In this blog, I will be showing you not only how to generate K2 SmartObjects, but also how to manage them inside the K2 Designer.
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.
First we need some data to publish. In this example, I will be generating a K2 SmartObject from Microsoft SQL Server. I have created a simple table in the database called Users.
Using the K2 SmartObject Tester, I will refresh the SQL Server Instance in order to reflect the Tables, Stored Procedures and Views from my database in my K2 Service Instance.
Now that my Users table is in the Table list, I will right-click it and click on “Create SmartObject”. Doing so will open the Publish SmartObject dialog box.
Two main areas we need to look at before publishing a K2 SmarObject is the Name & Category.
The Name of your K2 SmarObject is visible to other users of the K2 Designer, thus it is important to choose an appropriate name that follows a predefined naming convention. In this example I will call my K2 SmartObject Example.SMO.Users.
The Category of your K2 SmartObject will determine where in the K2 Designer the SmartObject will appear. Choosing the “Default” option will place the SmartObject in the “Default” directory in the K2 Designer.
Click on the “Publish SmartObject” button on the Toolbar in order to publish the SmartObject. If everything goes well, K2 will provide you with a “Successful” message.
Going back into K2 Designer, you can find the SmartObject by refreshing the Category that you published the SmartObject to. Right-click on the Category and click on the “Resfresh” button.
The Example.SMO.Users SmartObject appears now.
Congratulations, you have just successfully published your first K2 SmartObject.
Next time we will see what happens when we have a related stored procedure, and how we can publish the stored procedure to the same SmartObject by adding a new method to the existing K2 SmartObject.
About K2 SmartObjects
K2 SmartObjects is a patented technology that provides unified data access to a variety of disparate backend data sources. SmartObject data presents one view of the data world and liberates sometimes hidden or ‘dark data’ that are otherwise hard to expose to users. K2 SmartObjects integrates deeply with K2 blackpearl Workflow, K2 SmartForms and K2 Reports. K2 SmartObjects provide reliable data access that takes otherwise long to create using conventional IT programming methods.
About Velocity IT
Velocity IT is a UK based IT company that are business process architects and K2 masters. With over 15 years’ K2 design and development experience, we are the forefront of K2 solution design and implementation. Our K2 solutions have a user base of over 300,000+ users worldwide. Please visit velocity-it.com for more help and information.