13. (Optional) Clean up your K2 environment by deleting the application artifacts

DO NOT complete this step if you intend on working through the Administer the Leave Request Application and/or Report on the Leave Request Application tutorials. Both tutorials use the Leave Request application as a base to work from, so you do not want to delete any files before completing them. Return to this topic after you complete the tutorials and are ready to delete artifacts.

This optional step describes how you can clean your K2 environment by deleting the artifacts that you created in this tutorial. For example, if you are working in a shared environment, you may want to delete your tutorial applications to keep your environment clean and tidy.

Deleting artifacts (such as views, forms, SmartObjects, workflows, service instances and so on) removes them from the K2 server permanently and you cannot retrieve or restore them easily. You should only delete artifacts once you are certain that they are no longer needed. Also, once you start deleting application artifacts, other application artifacts might stop working, because they depend on the item that you just deleted.

Use the K2 Management site to delete deployed workflows

Begin by deleting the deployed versions of the Leave Request Workflow from the K2 server.

  1. From the K2 Management site, delete any process instances associated with the Leave Request Workflow. You are deleting any process instances that are active, running, stopped, or in error. You can also choose to remove reporting data as well.
    Location: Categories > K2 Learning > Leave Request > Workflow > Leave Request Workflow > Instances (remember that K2 Leaning might have a different name in your environment).
    1. From the Categories menu, navigate to the K2 Learning > Leave Request node (remember that K2 Leaning might have a different name in your environment). Expand the Workflow category and select the Leave Request Workflow.
      Select Workflow
    2. In the central pane, click the Instances tab. Check to see if there are any active, running, stopped, or erred process instances. If there are, select them and click the Delete button (there may be more than one instance). You see a pop-up where you have the option to delete reporting logs. Check the Delete Reporting Data (Logs) box, then click Delete. This removes any reporting data generated for the process instance. Repeat this step to remove all process instances.
      Delete Process Instances
  2. 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, you delete all versions along with the historical data and workflow reporting SmartObjects.
    Location: Workflow Server > Workflows > Workflow > Leave Request Workflow > Versions.
    Your artifact names may not match the steps exactly if you added your initials to make them unique. When an artifact name is referenced, use the name you entered when creating it. Artifacts include views, forms, SmartObjects, workflows, service instances, roles, groups, and SharePoint lists and libraries.
    1. Expand the Workflow Server > Workflows node. Expand the Workflow category and select Leave Request Workflow.
      K2 Management Site
    2. In the central pane, click the Versions tab. In the image below, there is only one version of the Leave Request 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 process instances in the prior step. Select a version and click Delete.
      Delete Workflow Versions
    3. On the Delete Workflow screen, select Delete all versions, then check the option to delete all historical data and workflow reporting SmartObjects. Click OK.
      Delete Workflow Options

Use K2 Designer to delete application elements

The next step is to remove application elements using K2 Designer. Here, you can remove views, forms, SmartObjects, workflow design files and categories.

  1. In K2 Designer, delete the Leave Request 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.)
    Location: All Items > K2 Learning > Leave Request > Workflow. Remember that the K2 Leaning category might have a different name in your environment.
    1. Return to K2 Designer. Navigate to your K2 Learning > Leave Request categories - remember that the K2 Leaning category might have a different name in your environment . Expand the Workflow category and select Leave Request Workflow. Right-click and select Delete. Click Yes for the confirmation.
      Delete Workflow
  2. Delete the Leave Request Form. (You must delete forms first, followed by the views used on those forms.)
    Location: All Items > K2 Learning > Leave Request > Forms.
    1. Expand the Forms category.
    2. Right-click Leave Request Form and select Delete. Click Yes for the confirmation. (If you see a message about referencing workflows, it is OK to continue.)
      Delete Form
  3. Delete each view. (There is no specific order for deleting views).
    Location: All Items > K2 Learning > Leave Request > Views.
    1. Expand the Views category. Right-click each view and select Delete. There is no specific order you must follow for deleting views. Click Yes for each confirmation.
      Delete Each View
  4. Delete the two SmartObjects. You do not have to follow any particular order.
    Leave Types
    Leave Request SmartObject
    Location: All Items > K2 Learning > Leave Request > SmartObjects.

    In the next few steps, you delete the SmartObjects. There are no associations between the two SmartObjects, so you can delete them in an order.

    1. Expand the SmartObjects category. Right-click the Leave Types SmartObject and select Delete. Click Yes for the confirmation.
      Delete SmartObjects
    2. Delete the Leave Request SmartObject.
  5. Delete the learning categories. You must delete the subcategories first (Forms, Views, SmartObjects, Workflow) and then Leave Request. Finally, you can delete K2 Learning if you do not intend building more tutorials, and remember that the K2 Learning category might have a different name in your environment.
    1. Delete the application’s categories. You must delete the subcategories first (Forms, Views, SmartObjects, Workflow) and then Leave Request.
      Delete Categories
    2. Finally, you can delete the K2 Learning category if you do not intend building more tutorials. Remember that the K2 Learning category might have a different name in your environment.

Use K2 Management Site to delete the service instances

Next, you return to the K2 Management site and delete the Leave Types service instance you created at the beginning of this tutorial.

  1. From the K2 Management site, delete the Leave Types service instance. Remember that the service instances might have different names in your environment.
    Location: Integration > Service Instances.
    1. In the K2 Management site, expand the Integration node, then click Service Instances.
      Expand Integration
    2. In the central pane, select Leave Types. Click the Delete button. Click OK for the confirmation. Remember that the service instance might have a different name in your environment.
      Delete Service Instances
Summary

Having completed this tutorial, you should know how to perform some more advanced application building tasks with K2, such as integrating with external systems and showing that data on a SmartForm, adding more advanced workflow functionality like rework loops and reminders, and configuring rules on forms to allow the form to behave differently depending on the form state.