Symptoms
It is impossible to delete SharePoint SmartObjects in the "SharePoint 2013 - sitename] - Management" category as well as service instances for them. Is there correct/supported procedure for this?
This is required in the scenario when you moving K2 server and SharePoint server at the same time and these objects are not required anymore, and moreover when they are present in the system, it is impossible to deploy solutions as it is not possible to change settings or remap service instances during deployment.
In other words, assume the following scenario:
1. You restored the K2 server from the database. There are service instances and smartobjects linked to the old SharePoint server which is inaccessible anymore.
2. You have solution package and deploying it to the K2 server using Package and Deployment tool.
3. On the analysis stage it is impossible to relink SmartObjects to the new SharePoint site URL as there are existing items in the system which you are unable to delete.
Diagnoses
When removing the K2 app from a site, the artifacts are not deleted by design as a safety method. The "clean-up" is only done on the SharePoint side, on the K2 side the artifacts are left intact - this is by design.
It is safe for the customer to leave the Management and System objects alone and this is was designed so that you cannot delete these artifacts as we would prefer customers to not delete or remove these.
If you want to configure objects and variables in a package to a new site, you should make use of PandD WEB UI. This approach will work much better that offline one, but in this case you have to create a package using online tool too.
There is also an existing feature request to consider possibility of adding into product some supported procedure to Uninstall/Remove all SharePoint artefacts including SMO's, Service Instance, etc. on K2 side (internal ID: TFS 624875).
Resolution
When removing the K2 app from a site, the artifacts are not deleted by design as a safety method. It is recommended to use PandD WEB UI to avoid issues you may face in the scenario described above.