Saving, copying and renaming workflows

  • 13 December 2022
  • 0 replies
  • 414 views

Badge +6

KB002953

PRODUCT: K2 Cloud Update 7, K2 Five

 

This article describes what happens when you save, copy (save as introduced in K2 Cloud Update 7), and rename workflows, and provides answers to frequently asked questions.
 

Introduction

When you are designing workflows and want to save, save as, or rename a workflow, you should be familiar with some fundamental principles:

  • There is a difference between designed and deployed workflows. A designed workflow is when you have created or edited a workflow in K2 Designer and saved your changes, but you have not ever deployed the workflow. In this case, the workflow definition only exists in the K2 Designer environment. When you deploy a workflow, the workflow definition is published to the K2 workflow server, and the workflow appears in the K2 Management site. Once the workflow is deployed, the workflow definition exists in both the K2 Designer environment and the K2 Management environment, but as separate files. Changes you make to the designed (saved) version are not applied to the deployed version until you deploy the designed version again. The difference between designed and deployed workflows is important because what happens when you save, save as, or rename the workflow in K2 Designer depends on whether or not you have ever deployed the workflow.
  • When you save, save as, or rename a workflow, you should know whether the workflow is designed or deployed.
  • Just like when you delete a workflow, you must carefully approach how you rename a deployed workflow because of the impact on other linked items. Generally, you should avoid renaming or deleting deployed workflows, but there are instances where this is necessary. When you rename or delete a workflow, you should understand the impact on other items like SmartForms, SmartObjects, and code that interact with that workflow.
  • If you want to create a copy of an existing workflow (designed or deployed), use the Save As function to save the workflow with a new name. This creates a separate copy of the workflow in the K2 Designer environment; essentially it is like copying a file on your computer. You would typically do this if you want to create a starting point for a new workflow based on an existing workflow. Keep in mind that you must go through the new workflow carefully to check and reconfigure linked items, such as references, SmartObjects, and forms so that the workflow functions as expected. You also need to configure the Start event of the new workflow.

In this article, the Workflow types & states section includes information on the terms and definitions used in this article. The Behavior section details the different behaviors when you save, save as, and rename designed and deployed workflows. In the FAQ section, you'll find answers to frequently asked questions.

 

The save as functionality was introduced in K2 Five (5.3) and is not available in earlier versions.

 

Workflow types & states

Use this section to become familiar with the terms used in this article.

Terms

Description

K2 Designer The K2 Designer is where you create workflows, forms, views, and SmartObjects. For more information see Get to Know the K2 Designer.
K2 Workflow designer The K2 Workflow Designer is the design tool that you use to build, edit, and deploy a workflow. For more information see About the K2 Workflow Designer.
Workflow design file When you create a new workflow, a workflow design file gets created. While you edit your workflow, the changes are saved to the design file. This file is saved to the K2 server but is not accessible outside of the K2 Workflow Designer. Sometimes referred to as a saved file.
Saved Your workflow is automatically saved while you build and edit it, or when you click the save icon. When you close the workflow designer, the workflow is saved and the minor version number increments by one (for example, 0.0.0.1 to 0.0.0.2). Note that the saved version number is not the same as the version number displayed in the K2 management site for deployed workflows.
Save As Use Save As when you want to create a new workflow that has similar requirements to an existing workflow. When you select Save As, you create a copy of the workflow designed file. Some reconfiguration of the new workflow is necessary.
Deployed Deployed means that the workflow is published to the K2 server, either by deploying with the K2 workflow designer or using the Package and Deployment tool to deploy a workflow. You can keep track of the number of times a workflow was deployed by looking at the versions tab for the workflow in the K2 management site.
Packaged workflow You use the K2 Package and Deployment tool to create a package of your K2 solution. A solution might include SmartObjects, views, forms, and workflows that are linked with each other. This means you can package a solution in one environment and deploy it to a different environment.
Workflow status icon Icons are used to indicate the state of your workflows, such as designed or deployed:
blue workflow icon with red arrow(blue workflow icon with red arrow): indicates that your workflow is deployed.
blue workflow icon(blue workflow icon): indicates that your workflow is saved. This icon is also used to show that a deployed workflow is edited and saved but not yet redeployed.

 

Behavior of Workflow Save, Save As, and Rename

This section contains descriptions of what happens when you save, save as, and rename designed and deployed workflows.

Designed workflows

Use this to discover how designed (not yet deployed) workflows behave when performing the following operations:

 

Save
  • Workflows are automatically saved as you edit them using the K2 workflow designer.
  • While you work, the Save icon flashes when auto-saving, and you can manually click the save icon to save immediately. When saving, the changes you made are saved to the workflow design file (but are NOT deployed to the workflow server).
  • Every time the workflow is saved (either by clicking the Save icon or when auto-saving) the minor version number for the workflow design file increments by one. for example 0.0.0.3 to 0.0.0.4.
  • Note that auto-save does not occur if you have not made any changes to the workflow since the last save.
  • When you close the workflow, the minor version number increments by one if you made changes since the last auto-save.
  • You will not see the workflow in K2 Management (under the Workflow Server node) as it has not yet been deployed.
  • At this point you can only delete the workflow within K2 Designer. If you delete the designed (saved) workflow, it is gone and unrecoverable.

 

Save As
  • The save as functionality was introduced in K2 Five (5.3) and is not available in earlier versions.
  • In K2 Designer, use the Save As option to create a copy of a workflow.
  • When you create a copy, the workflow version number for the copied workflow design file is reset to 0.0.0.1.
  • When you edit the copied workflow, the Save operation behaves as described in the Save section above.
  • Any forms integration that you configured in the original workflow is NOT included in the copied workflow. This applies to both the Start step and the Form tab on the Task step. You must reconfigure the integration, usually pointing the workflow to a different form. You can integrate with the existing workflow form, but keep in mind that this overwrites the form state rules. The copied workflow uses the default state and starts when you submit the form. This means that the original workflow no longer starts when the form is submitted.
  • All steps in the original workflow are also in the copied workflow. This includes configuration of the steps and functions, expressions, references and variables you may have created.
  • When you create a copy of a workflow with the Save As operation, only the workflow design file is copied. Any associated items such as views, forms, and SmartObjects that are used or referenced by the workflow are not copied. If desired, you can create copies of these items and use them with the copied workflow, but you must reconfigure all workflow steps or functions that use these items to point to the copies of those items.

 

Rename
  • In K2 Designer, you can open the designed workflow and rename it using the workflow Properties tab.
  • Renaming a workflow that has not been deployed yet will NOT create a copy of the workflow. Think of it as renaming a file on your computer.
  • When you edit the renamed workflow, the Save operation behaves as described in the Save section above.

Deployed workflows deployed using the K2 Designer

 

 

First Deployment
  • As you edit the workflow in K2 Designer, the workflow version increments as described in the Save section above.
  • When you select File > Deploy to deploy the workflow to the K2 workflow server, the design file version is incremented to a full version (e.g. changes from 0.0.0.3 to 1.0.0.0). The workflow version number on the K2 workflow server increments as well, but in the format 1.0/2.0.
  • The workflow shows in K2 Management (under the Workflow Server node).

 

Save after first deployment
  • If you save a workflow after it was deployed, the minor version number increments as before, e.g. from 1.0.0.1 to 1.0.0.2.
  • As you edit the workflow in K2 Designer, the workflow version increments as described in the Save section above.
  • You must deploy the workflow again before any changes are published to the K2 workflow server.

 

Save As after first deployment, do not deploy the copy
  • In K2 Designer, you can use the Save As option to create a copy of a deployed workflow.
  • When you create a copy, the workflow version number for the copied workflow design file is reset to 0.0.0.1.
  • As you edit the workflow in K2 Designer, the workflow version increments as described in the Save section above.
  • Any form integration that you configured in the original workflow is NOT included in the copied workflow. This applies to both the Start step and the Form tab on the Task step. You must reconfigure the integration, usually pointing the workflow to a different form. You can integrate with the existing workflow form, but keep in mind that this overwrites the form state rules. The copied workflow uses the default state and starts when you submit the form. This means that the original workflow no longer starts when the form is submitted.
  • All steps in the original workflow are also in the copied workflow. This includes configuration of the steps and functions, expressions, references and variables you may have created.
  • When you create a copy of a workflow with the Save As operation, only the workflow design file is copied. Any associated items such as views, forms, and SmartObjects that are used or referenced by the workflow are not copied. If desired, you can create copies of these items and use them with the copied workflow, but you must reconfigure all workflow steps or functions that use these items to point to the copies of those items.
  • The copied workflow does not show in K2 Management (under the Workflow Server node) as it has not yet been deployed.

 

Save As and then deploy the copy
  • While editing the copied workflow, the behavior as described in Save As after first deployment, do not deploy the copy applies.
  • When you deploy the copied workflow, it is published to the K2 workflow server as a new workflow with version 1.0 and the workflow design file version increments to 1.0.0.0.
  • The copied workflow shows in K2 Management as a new workflow (under the Workflow Server node).

 

Rename a deployed workflow
  • In K2 Designer, you can open a previously-deployed workflow and rename it using the workflow Properties tab.
  • Renaming a workflow that has been deployed creates a copy of the workflow design file in K2 Designer.
  • After renaming a deployed workflow, browse to the category and locate the renamed workflow. You will notice that the folder contains the renamed workflow as well as the original workflow that you renamed.
  • Notice that the renamed workflow has the savedImageicon and the original workflow has the deployedImageicon.
  • As you edit the workflow in K2 Designer, the workflow design file minor version increments, continuing from the last saved version of the non-renamed workflow, e.g. 1.0.0.1 to 1.0.0.2.
  • When you deploy the renamed workflow, it will appear in K2 management as a new workflow with a major version. The original workflow remains as a deployed workflow on the K2 workflow server.
  • When you deploy the renamed workflow, it is created as a new workflow and appears in the K2 management site. The original version of the workflow also appears in the K2 management site.
  • Any instances of the original workflow (before the rename) do not automatically migrate to the new workflow (after the rename).
  • When you rename a workflow you must manually make the following changes, especially if you want to replace the original one with the renamed one:
    • Open the original workflow and remove the start rule integration.
    • Open the renamed workflow and configure the start rule integration using the same form you did in the original workflow.
    • If you created any custom code that integrates with the workflow, you may need to change the workflow name and location in your code.
    • Remember to deploy the renamed workflow.

Deployed workflows, deployed with the Package and Deployment tool

You can also deploy workflows using the K2 Package and Deployment tool instead of deploying directly from the K2 workflow Designer. The following behaviors occur when you deploy a workflow with the K2 Package and Deployment tool (and assuming you did not design this workflow in the same environment it was deployed to).

  • The workflow shows in K2 Management (under the Workflow Server node).
  • Notice the workflow has theImageicon. This means the workflow is deployed to your environment using K2 Package and Deployment.
  • The workflow designed file version is in the major format 1.0.0.0
  • You can edit the workflow in K2 workflow designer as if you had created it in K2 Designer.
  • As you edit the workflow in K2 Designer, the workflow version increments as described in the Save section above.
  • You can deploy the edited version of the workflow, in which case the design file version changes to the format 1.0.0.1 and the deployed workflow version will increment (e.g. to 2.0.0.0).
  • If you Save As or rename the workflow design file in the environment that the workflow was deployed to using the Package and Deployment tool, the behavior as described in Save As after first deployment, do not deploy the copy and Rename a deployed workflow apply.
  • If you Save As or rename the workflow design file in the environment that the workflow was sourced FROM using the Package and Deployment tool, the behavior as described in Save As and then deploy the copy and Rename a deployed workflow apply.

FAQs

This section contains answers to frequently-asked questions about saving, saving-as, and renaming workflows.

 

 

Q: How do I create a copy of a workflow that I haven’t deployed yet?

A: In K2 Designer, find the workflow you want to make a copy of. Select it and click Save As. You must give the new workflow a unique name. Select the default location or another category for the new workflow. Click OK. Browse to the new workflow, select it and click Edit to configure your copied workflow. Remember to deploy your workflow when you’re done configuring it. For more information, see Create a copy of a Workflow.
Any form integration you added on the existing workflow is not included in the copied workflow. This applies to both the Start step and the Form tab on the Task step. You must reconfigure the integration, typically with a new form. You can integrate with the existing workflow form but keep in mind that this overwrites the form state rules. The copied workflow is set as the default state and starts when you submit the form. This means your original workflow no longer starts when the form is submitted. All steps in the original workflow appear in the copied workflow. This includes all step configurations. Any inline functions (with or without SmartObject configuration) added to the original workflow steps appear in the copied workflow.

When you create a copy, only the workflow design file is copied to either the default location (the same category where the existing workflow is) or a different category you selected. Views, forms and SmartObjects you created for the existing workflow are not copied and remain in the original category. You can create a copy of these items and use them with the new (copied) workflow, but you must reconfigure all steps that use these items to point to the new copies of those items.

 

Q: How do I create a copy of a workflow that I’ve deployed from the workflow design tool?

A: In K2 Designer, find the workflow you want to make a copy of. Select it and click Save As. You must give the new workflow a unique name. Select the default location or another category for the new workflow. Click OK. Browse to the new workflow, select it and click Edit to configure your copied workflow. Remember to deploy your workflow when you’re done configuring it. For more information, see Create a copy of a Workflow.
Any form integration you added on the existing workflow is not included in the copied workflow. This applies to both the Start step and the Form tab on the Task step. You must reconfigure the integration, typically with a new form. You can integrate with the existing workflow form but keep in mind that this overwrites the form state rules. The copied workflow is set as the default state and starts when you submit the form. This means your original workflow no longer starts when the form is submitted. All steps in the original workflow show in the copied workflow. This includes all step configurations. Any inline functions (with or without SmartObject configuration) added to the original workflow steps appear in the copied workflow.

When you create a copy, only the workflow design file is copied to either the default location (the same category where the existing workflow is) or a different category you selected. Views, forms and SmartObjects you created for the existing workflow are not copied and remain in the original category. You can create a copy of these items and use them with the new (copied) workflow, but you must reconfigure all steps that use these items to point to the new copies of those items.

 

Q: How do I rename a workflow that I’ve not deployed yet?

A: In K2 Designer, locate the workflow you want to rename. Select it and click Edit. After your workflow opens, expand the Configuration Panel. Click the workflow Properties tab and, in the Process Name field, rename the workflow. For more information, see Rename a Worklfow.

 

Q: How do I rename a workflow that I’ve deployed from the workflow design tool?

A: In K2 Designer, locate the workflow you want to rename. Select it and click Edit. After your workflow opens, expand the Configuration Panel. Click the workflow Properties tab and in the Process Name field rename the workflow. For more information, see Rename a Worklfow.
Renaming a workflow that you've already deployed essentially creates a new workflow with the new name, and the original workflow remains as a deployed workflow on the K2 server. Workflow integration between forms and your workflow might be broken after renaming, so check the integration and reconfigure the renamed version if necessary. If you created any custom code that integrates with the workflow, you may need to change the workflow name and location in your code.

Any existing instances of the original workflow (before the rename) do not automatically migrate to the new workflow after you rename it. Renaming a deployed workflow does not affect current or running instances of the workflow. Instances started after the name change are started using the new name.

After renaming, it is recommended that you remove integration in the original (old) workflow from forms and rules used by the renamed (new) workflow.

 

Q: How do I create a copy of a workflow that was deployed with Package and Deployment?

A: In K2 Designer, find the workflow you want to make a copy of. Select it and click Save As. You must give the new workflow a unique name. Select the default location or another category for the new workflow. Click OK. Browse to the new workflow, select it and click Edit to configure your copied workflow. Remember to deploy your workflow when you’re done configuring it. For more information, see Create a copy of a Workflow.
Any form integration you added on the existing workflow is not included in the copied workflow. This applies to both the Start step and the Form tab on the Task step. You must reconfigure the integration, typically with a new form. You can integrate with the existing workflow form but keep in mind that this overwrites the form state rules. The copied workflow is set as the default state and starts when you submit the form. This means your original workflow no longer starts when the form is submitted. All steps in the original workflow show in the copied workflow. This includes all step configurations. Any inline functions (with or without SmartObject configuration) added to the original workflow steps appear in the copied workflow.

When you create a copy, only the workflow design file is copied to either the default location (the same category where the existing workflow is) or a different category you selected. Views, forms and SmartObjects you created for the existing workflow are not copied and remain in the original category. You can create a copy of these items and use them with the new (copied) workflow, but you must reconfigure all steps that use these items to point to the new copies of those items.

 

Q: How do I rename a workflow that was deployed with Package and Deployment?

A: In K2 Designer, select the workflow and click EditRename the workflow from the workflow Properties tab. On the renamed workflow, reconfigure the start rule integration and select the same form you used to start the workflow. Make sure to deploy the renamed workflow (File > Deploy). It is suggested to NOT open the original workflow. This will cause an error in your renamed workflow.
Renaming a workflow that you've already deployed essentially creates a new workflow with the new name, and the original workflow remains as a deployed workflow on the K2 server. Workflow integration between forms and your workflow might be broken after renaming, so check the integration and reconfigure the renamed version if needed.

If you created any custom code that integrates with the workflow, you may need to change the workflow name and location in your code. Any existing instances of the old workflow (before the rename) do not automatically migrate to the new workflow (after the rename). Renaming a deployed workflow does not affect current or running instances of the workflow. Instances started after the name change are started under the new name. After renaming, it is a best practice to remove integration in the original (old) workflow from forms and rules used by the renamed (new) workflow.

 

Q: Can I package a workflow that has not been deployed yet?

A: No. You must deploy a workflow before you can package it.

 

Q: How do I delete a workflow that has not been deployed yet?

A: A workflow that has not been deployed is saved as a workflow design file. This means the workflow has not been deployed to the K2 workflow server. To delete it, open K2 Designer and find the workflow. Select it and click Delete. For more information, see Delete a Workflow.

 

Q: How do I delete a workflow that has been deployed?A: To delete a deployed workflow, browse to K2 Management. Find the workflow in the Workflow Server node and select the Versions tab. Select a version and click Delete. To remove all version, select Delete all versions. For more information, see Delete a Workflow.

When deleting a workflow keep in mind the following:
  • Deleting a workflow might break items that depend on that workflow, such as forms, views, SmartObjects, and code. You should understand the impact of deleting a workflow before you do so.
  • It is not possible to undo a delete action and recover a deleted version without restoring the K2 database from a recent backup.
  • Deleting a version of a workflow with running instances can cause orphaned user tasks.
  • Deleting a workflow and selecting the Delete all Versions option removes all version of the deployed workflow, including the current version used to start new instances.
  • Deleting a workflow and selecting Delete all historical (log) data for selected versions and Delete workflow reporting SmartObjects deletes all instance data as well as any associated K2 items. You cannot recover these objects once they are deleted.
  • Deleteing a worklfow and selecting both Delete all Versions and Delete all historical (log) data for selected versions deletes all running instances and completed instances of the workflow.

 

Q: How do I delete a workflow completely (i.e. the design file as well as the deployed workflow)?

A: To completely delete a workflow design file and the deployed workflow, use the K2 management site to delete the deployed workflow and then use K2 Designer to delete the workflow design file from the category system.

 

Q: What happens when I delete a workflow from K2 workflow designer?

A: If the workflow has not ever been deployed, deleting a workflow from K2 Designer deletes the workflow design file. If the workflow was previously deployed, the latest version of workflow design file is technically deleted, but you can still open the last deployed version of the workflow in K2 Designer. In the category system, you will notice that the ‘deleted’ workflow icon changed to the ‘deployed’ iconImage, but you can open the workflow with K2 workflow designer.

 

Q: What happens when I delete a workflow from K2 Management Site?

A: Deleting a workflow from the K2 management site only deletes the deployed workflow definition (the default version, a specific version or all versions of the deployed workflow, depending on your choice when you delete the workflow). This operation does not delete the workflow design file in K2 Designer and you can still edit and redeploy the workflow from K2 Workflow Designer if desired.

 

Q: How does the auto-save function work?

A: By default, the auto-save function is turned on in K2 Workflow Designer. While you configure your workflow, you’ll notice the save icon (top right) pulses. This means data is sent to a temporary table on the server. Every two minutes data in this table is auto-saved to the database. This save also increments the minor version number, for example 0.0.0.1 to 0.0.02. When you close the K2 workflow designer, data from the temporary table is saved to a permanent table in the database and the version increments again, for example 0.0.0.2 to 0.0.0.3.

Auto-saved data, stored in the temporary table, ensures that if you lose connection or the power goes off, you’ll see your changes when you edit the workflow again.

 

Q: How do I roll back to a previously-saved version of a workflow in K2 workflow designer?

A: You cannot roll back to a previous saved version. You can, however, roll back to a previously deployed version.

While you configure your workflow, you’ll notice the save icon (top right) pulses. This means data is auto-saved to the server and the workflow version increments, for example 1.0.0.1 to 1.0.0.2 to 1.0.0.3 and so on. These auto-saved increments are referred to as minor versions of the saved workflow design file. It is not possible to roll back to a previous minor version of the designed workflow. As soon as you deploy this workflow (in this example for a second time), all changes saved during the minor versions are deployed to the server. The deployed version number changes to 2.0.0.0.
When editing the workflow and saving it increments, the minor version is updated, for example from 2.0.0.1 to 2.0.0.2. You can roll back to a previously-deployed version by deleting the workflow design file in K2 Designer. When you do this, the workflow version shows as the last major version that was deployed, for example, 2.0.0.0 (no minor version). Just remember that all changes and configuration you made to the workflow after the second deployment are lost. Essentially, you are rolling back to the last deployed version of the workflow.

 

Q: How do I roll back to a previously-deployed version of a workflow?A: Browse to K2 Management and find the workflow in the Workflow Server node and select the Versions tab. This tab shows all deployed version for the workflow in the Version column. Example 1.0.x.x, 2.0.x.x, 3.0.x.x and 4.0.x.x (Default). In this example the default version is 4.0 and there are three previously-deployed versions of the workflow. To roll back to a previously-deployed version (in this case 3.0), select version 3.0 and click Set as Default. The new default version of the workflow shows as 3.0 (Default). For more information, see Versions.

When you set a previous version of a workflow as the default, keep in mind the following:

  • Existing workflow instances are NOT migrated/changed/updated when you change the default workflow version.
  • Changing the default version only affects new instances of the workflow.
  • When you deploy a new version of the workflow, it automatically becomes the default version. Even if you previously set a different version as the default version. You may need to go back and reset the default version of the workflow if you deploy a newer version of the workflow.
  • Since SmartObjects and SmartForms always use the latest deployed version, there is a possibility that modifying the default version of a workflow might result in unintended behavior if there are newer versions of SmartObjects and SmartForms referenced by the workflow, resulting in errors or unexpected behavior. Since it is unpredictable how SmartObjects and SmartForms may be used in workflows, it is difficult to provide specific guidance, but bear this potential impact in mind when setting the default version of a workflow. Where possible, it is recommended to allow existing instances of the workflow to complete before making changes to the default version of a workflow, especially when updates to SmartObjects and SmartForms are used in the workflow.

0 replies

Be the first to reply!

Reply