Registering a new SQL Server K2 Service Instance and generating associated K2 SmartObjects
The K2 SmartObjects available in the K2 Designer are usually associated with Data Sources registered via the SmartObject Services Tester.
In this blog I’d like to show you not only how to register a new SQL Server Service instance using the K2 SmartObject Services Tester, but generate the associated K2 SmartObjects as well.
For the purposes of this blog I have created a new Database in SQL Server called CompanyDatabase and created three associated tables i.e. Customers, Products and Invoices.
First of all, we need to double-click the “SmartObject Service Tester.exe” file found in the “Bin” directory located in the K2 Blackpearl application folder. This will open the K2 SmartObject Service Tester.
Next we need to register a new SQL Server Service instance. Click the “Plus” next to “ServiceObject Explorer” in the tree view.
Scroll down and find the item labelled “SQL Server Service”. This is where you’ll find a list of all the previously registered SQL Server Services. Right click this item and select “Register Service Instance”. The “Add Service Instance” dialog window will appear.
The “Add Service Instance” dialog window will appear.
The area of the dialog that we will be focusing on will be the “Service Keys” area at the bottom of the screen. Enter the Database name in the “Database” field and the Server address in the “Server” field.
Click on the “Next” button.
Confirm the details of the new SQL Server Service instance in the “Service Instance Information” window. Click on the “Add” button to finalise the new instance. A message will appear notifying you of the successful addition.
Your new SQL Server Service instance can now be found by explorer the “SQL Server Service” item mentioned earlier in the blog.
The new SQL Server Service instance is ready for use. The next step is to generate the associated SmartObjects. Right-click on the SQL Server Service instance you just created, and click on the “Generate SmartObjects” item.
The “Generate SmartObject” dialog window will appear. Notice the three areas of interest, “Create SmartObjects”, “Existing Service Objects” and “Removed Service Objects”. We will be focusing on the “Create SmartObjects” section. All the tables from the database we just registered will appear in this section. Use the “checkbox” next to each item, to indicate which items you’d like to generate.
Click on the “OK” button to continue. Your K2 SmartObjects have now been generated and are available to use in the K2 Designer. The “Generate SmartObjects” tool is a great way to quickly generate the K2 SmartObjects associated with your Data Source. All the CRUD functions have been generated and are available without the need to manually create each one.