How to: Clean your K2 environment by deleting application artifacts

This how-to demonstrates how you can clean your K2 environment by deleting application artifacts such as views, forms, SmartObjects, workflows, and services instances that, when combined, form K2 applications. Removing unnecessary artifacts keeps your environment clean, and is especially useful in shared or development environments. When deleting an application, you must follow a set order, as described in the detailed steps below.

Essentially, the sequence for deleting application artifacts is:

  1. Workflow instances
  2. Deployed workflow definitions
  3. Workflow design files
  4. Forms
  5. Views
  6. SmartObjects
  7. Category system folders
  8. Service Instances
  9. Roles

Depending on the type of application, you may need to delete additional artifacts or access the application artifacts in different ways. This topic is divided into the following types of application - use the appropriate steps depending on the type of application you want to delete:

Deleting artifacts removes them from the K2 server permanently and you cannot retrieve or restore them easily. You should only delete artifacts once you are certain they are no longer needed. Also, once you start deleting application artifacts, other application artifacts or other applications might stop working because of dependencies on the deleted items.
Before proceeding, you should be able to open and access the following K2 components: K2 Designer and Management. If you do not know how to access K2 systems, see Accessing Sites. If you are deleting K2 application artifacts that integrate with SharePoint, you may also need access to SharePoint People and Groups, SharePoint Site Settings, and SharePoint Site Contents.

Deleting artifacts of K2 applications

This section describes how to delete artifacts of a K2 application. Typically, this is the kind of application you would create with the K2 Designer tool, and might include workflows, SmartObjects, forms and views.

The sample application in this section is called Expense Claim. This sample application contains views, forms, SmartObjects, service instances, and a workflow. Your application may include some or all of these application artifacts.

Use the Management site to delete deployed workflows

Begin by deleting workflow instances and deployed versions of your application's workflows from the K2 server. Use this first step as an opportunity to see what workflow instances might be active for the application you want to delete; depending on your requirements, it is possible that you may need to wait for active workflow instances to complete before you can delete the application.

  1. Launch the Management site. Navigate to and select your application's workflow in the Workflow Server > Workflows node.
    1. Launch the Management site. Expand the Workflow Server > Workflows node. Locate and select your workflow. (You may need to expand additional categories, depending on the category structure for your application.)
      Workflow Server
  2. Delete all workflow instances associated with your application's workflow. You are deleting workflow instances that are active, running, stopped, or in error. You can also choose to remove reporting data as well. With your workflow selected in the Workflows category, click the Instances tab in the central pane.
    1. To access a list of all workflow instances for your application's workflow, select your workflow in the Workflows category (in the left column) and click the Instances tab in the central pane. You see a list of all workflow instances including instances that are active, running, stopped, or in error.
      Workflow Instances
  3. Select a workflow instance and click Delete. You see a pop-up where you have the option to delete reporting logs. Check the Delete Reporting Data (Logs) box to delete all reporting and audit data generated for the workflow instance. Click Delete. Repeat this step and delete all workflow instances from the list.
    1. On the Process Details screen, select a workflow instance and click Delete. When you see the Delete Process Instance confirmation, check the box to Delete Reporting Data (Logs). Click Delete to complete the action.
    2. Using the steps above, delete any remaining workflow instances until the list is empty.
  4. Delete all versions of the workflow. You may see more than one version, and you have the option to delete all versions or specific versions. In this case, delete all versions along with the historical data and workflow reporting SmartObjects. Click the Versions tab to access a list of your workflow's deployed versions. Select a version and click Delete. To delete all versions at once, select Delete all versions and check the boxes to delete historical (log) data and workflow reporting SmartObjects.
    Delete Workflow Versions
    1. Still in the Workflow Server > Workflows category, select your workflow if it is not already. In the central pane, click the Versions tab. In the image below, there is only one version of the Expense Claim Workflow. You may have several versions, depending on how many times you deployed the workflow. Notice the columns for Active, Running, Stopped, and Error instances. You should see zeros here, since you deleted all workflow instances in the prior step. Click the refresh icon if any of the columns are not showing zeros. Select a version and click Delete.
      Delete Workflow Versions
    2. On the Delete Workflow screen, select Delete all versions and check the option to delete all historical data and workflow reporting SmartObjects. Click OK.
      Delete Workflow Options

Use K2 Designer to delete other artifacts including views, forms, and SmartObjects

The next step is to remove views, forms, SmartObjects, workflow design files, and categories. You perform this action in K2 Designer.

  1. Open K2 Designer. Delete your workflow design file. (In the previous step, you removed workflows published to the K2 server. In this step, you are removing the "design" copy of your workflow.)
    When you right-click the workflow design file, you should see a Delete option. If you do not see a Delete menu option, it may be because the workflow was deployed to the environment with the Package & Deployment tool. If needed, you can select the option to Edit the workflow and save the workflow. You should then see the Delete menu option.
    1. From K2 Designer, navigate to your application's categories. Right-click your workflow and select Delete. Click Yes for the confirmation.
      Delete Workflow
      If you do not see a Delete option, it may be because the workflow was deployed to the environment with the Package & Deployment tool. If needed, you can select the option to Edit the workflow and save the workflow. You should then see the Delete menu option.
  2. Delete your application's forms. You must delete forms first, followed by the views used by those forms.
    1. Right-click each form in your application and select Delete. Click Yes for the confirmation. You must delete forms before you can delete views. If you see a message about associated workflows, you can ignore it and continue, because you already deleted the workflows for the application in previous steps.
      Delete Report Form
  3. Delete your application's views.
    1. Right-click each view in your application and select Delete. Click Yes for each confirmation.
      Delete Each View
  4. Delete your application's SmartObjects. You must follow the order below because of associations between SmartObjects.
    1. SmartObjects not associated with other SmartObjects (such as an independent SmartObject used for reporting)
    2. SmartObjects that provide supporting services, such as calculations or control values
    3. SmartObjects that store child records
    4. SmartObjects that store primary, or parent records
    1. Navigate to your SmartObjects. Delete independent SmartObjects first (or SmartObjects that do not have an association with other SmartObjects). In the image below, the Expense Claim Reporting SmartObject does not have any associations with the other SmartObjects, so it's deleted first. Right-click the SmartObject and select Delete. Click Yes for the confirmation.
      Delete SmartObjects
    2. Delete any SmartObjects that provide control values (such as drop-down lists) or perform functions (such as calculations).
    3. Delete any child SmartObjects. These are data sources used to store child records that are linked to parent records.
    4. Delete the primary, or parent SmartObject.
  5. Delete your categories beginning with any subcategories (if you have them).
    1. Delete your application’s categories. You must delete subcategories first, followed by the main category.
      Delete Categories

Use the Management site to delete service instances and roles

Next, you return to the Management site and delete any service instances and roles you created for the application.

  1. From the Management site, delete any service instances created for the application. You find service instances in the Integration > Service Instances node.
    1. In the Management site, expand the Integration node and click Service Instances. In the central pane, select your service instance and click Delete. Click OK for the confirmation. Repeat this for any remaining service instances you created for the application.
      Delete Service Instances
  2. Delete any roles you created for the application. You find roles in the Users > Roles node.
    1. Expand the Users node. Select Roles. In the central pane, select any roles you created for the application and click Delete. Click OK for the confirmation.
      Delete Finance Role
    2. At this point, you have deleted all artifacts for your K2 application. Performing this maintenance helps keep your K2 environment neat and tidy, especially in shared environments.

Deleting artifacts of K2 for SharePoint applications

This section describes how to delete artifacts from a K2 for SharePoint application such as views, forms, workflows, and SmartObjects. For information on deleting the K2 for SharePoint app from your environment, see Removing K2 artifacts and integration from SharePoint.

The sample application in this section is called Site Requests, and the application contains views, forms, SmartObjects, a workflow, and a SharePoint list. Your application may include some, but not all, of these artifacts.

Use the K2 Application elements page toolbar to delete views, forms, SmartObjects, and workflows

  1. Navigate to the K2 Application elements page using the K2 > Application menu option from your list or library landing page.
    1. You delete K2 for SharePoint application artifacts (such as views, forms, SmartObjects, and workflows) from the K2 Application elements page. From your SharePoint list or library landing page, click Application in the K2 menu to open the application page.
      Delete Workflow
  2. From the K2 Application elements page, select your application's workflow and click Delete. You see a message that gives you the options to delete all versions and historical log data. Check both of these options and click Yes.
    1. The K2 Application elements page contains a list of all the artifacts for your application. To clean your environment, begin by deleting the workflow. Select your application's workflow and click Delete.
      Site Requests Artifacts
    2. You see a confirmation message asking if you want to delete all versions and running instances, as well as historical log data. Check the box for each option and click Yes.
      Workflow Delete Confirmation
    3. It may take a few minutes for K2 to process the command. First, K2 deletes any active workflow instances, then it deletes all versions of the workflow. Typically, there is a new version each time you deploy the workflow, so you may have several versions to delete, depending on how many times you deployed the workflow.
      Application Elements Page

  3. Delete the application forms.
    1. Next, you delete all the forms. You must delete forms before views. Select a form and click Delete. Click Yes for the confirmation. Repeat this step and delete the remaining forms.
      Delete Forms
  4. Delete the application views.
    1. Next, delete the views. Select a view and click Delete. Click Yes for the confirmation. Repeat this step and delete the remaining views.
      Delete Views
  5. Delete the application SmartObjects. You cannot delete SmartObjects individually from the K2 Application elements page due to underlying associations between SmartObjects. Use the Delete All button to remove the remaining data sources. This option removes associations and then removes the SmartObjects.
    1. In the steps above, you deleted artifacts individually. To complete the process, you need to delete the application's SmartObjects. You cannot delete SmartObjects individually from the application elements page due to underlying associations between SmartObjects. Click Delete All.
      You might have noticed the Attachments SmartObject (and views you just deleted). These artifacts are specific to SharePoint applications. K2 adds them for you (when you generate artifacts from a list or library) so that you can add and store attachments from your workflow forms.
      You may be wondering if you can click the Delete All button in the first place. You can! The purpose of this how-to is to show you how to remove artifacts individually and the order to use. However, you can use the Delete All button up front if you want to save time. Be aware however, that you are deleting all artifacts including views, forms, SmartObjects, workflows, and categories and you cannot easily retrieve or restore them.
      Delete All
    2. You see a confirmation message that tells you all items are removed, including categories. Click Yes.
      Confirmation Message

Use SharePoint tools to delete the SharePoint list and subsite.

You've deleted the K2 artifacts for the application (views, forms, SmartObjects, workflow). For a complete scrub of the application, delete the SharePoint list or library and finally, your subsite (if you created one).

  1. Delete the SharePoint list or library and subsite (if you created one).
    1. Navigate to the list or library's Settings page.
      List Settings Page
    2. Under Permissions and Management, click Delete this list (or document library) and click OK for the confirmation.
      Delete Site Requests List
    3. Delete the subsite (if you created one). Contact your SharePoint administrator for instructions on deleting sites in your environment, if necessary.
    4. At this point, you have deleted all artifacts for your K2 for SharePoint application. Performing this maintenance helps keep your K2 environment clean, especially in shared or development environments.