< class="prominent-subhead ">

How to check which SmartObjects belong to specific service instance?

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.


Consider the following scenario: during Package and Deployment, you created a duplicate Service Instance (by mistake) which has a display name identical to another existing service instance (e.g. you created an additional Endpoint Assembly service instance which points to exactly the same DLL file as an existing service instance with the same display name).

In this scenario it is necessary to delete the duplicate service instance and be sure you are deleting the right one (i.e. no existing/used SmartObjects will be impacted by its removal). To be able to do that you need to check which SmartObjects belong to which specific service instance.

Before You Begin

Make sure you backup your K2 database before deleting the service instance, to be able to rollback this operation.

How-to Steps

There are two ways to check which SmartObject belongs to which specific service instance:

1. Use the Tester Tool > Tools > Search SmartObjects > Service.

2. Or by using the SQL script which has to be run against the K2 database:

SELECT DISTINCT SystemName as SMOSystemName, DisplayName_XML AS SMODisplayName, SmartObjectGUID, SO.ID.value('@guid', 'nvarchar(100)') AS ServiceInstanceGUID
FROM [SmartBroker].[SmartObject]
CROSS APPLY SmartObjectXML.nodes('/smartobjectroot/methods/method/serviceinstances/serviceinstance[1]') AS SO(ID)
WHERE SO.ID.value('@guid', 'nvarchar(100)') = '%INSERT_SI_GUID%'

Once you've identified the "unnecessary" service instance (the one which does not have SmartObjects linked to it), you can delete it using the Tester Tool utility.