It has often happened that I make changes to my K2 Service Object, but then these changes do not reflect when I execute the Service Method through my K2 SmartForms.
When these type of scenarios happen your first point of call is usually the K2 SmartObject Tester.
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.
Note that the executable to this program can be found in the following location: C:Program Files (x86)K2 blackpearlBinSmartObject Service Tester.exe.
A. Refreshing the service instance.
Usually your first reaction would be to refresh the service instance. This is done by right clicking on the service instance and then selecting ‘Refresh Service Instance’, as indicated in the screenshot below:
B. Refreshing the service type
This is unfortunately usually not sufficient in older versions of K2 Blackpearl. I would rather recommend refreshing the entire service type, as this usually successfully updates the service instance to execute the latest version of your code. This is accomplished by right-clicking on the Service Type and selecting the ‘Refresh ServiceType’ option, as indicated below:
C. Updating the service instance
If your changes are still not reflected when you explore the service instance, the other option is to Update the service instance. This basically re-adds the service instance, and executes all the initialization code again. This is achieved by right-clicking on the service instance and selecting ‘Edit Service Instance’. You then select ‘Next’ in the following screen and then ‘Update’ in the final screen. This process is clarified in the following screen shots:
Step 1:
Step 2:
Step 3:
D. Delete and Re-add the service instance
Under extreme circumstances you might deem it necessary to delete and re-add a service instance. There is one gotcha here which I just want to make you aware off. Most of K2’s relationships and referenes work with Guid’s and before deleting/readding a service instance it is critically important to be aware of this. Before you delete the service instance follow the steps above (in C. Updating the service instance), and take note of the GUID in Step3, also indicated below.
Write this Guid down! After you have noted the guid you can delete the service instance by right-clicking on it and selecting the ‘Delete Service Instance’ option. You can now re-add it by right-clicking on the Service Type and selecting ‘Register ServiceInstance’. Follow the wizard as indicated in (C. Updating the service instance) and then make sure that you enter this exact GUID in the final step. This will ensure that none of your SmartObjects break, as they will still be referencing this service instance based on the GUID you supply here. The Display Name and System Name does not really matter.