Skip to main content

Hi guys,

I created a complex workflow 1 which runs with about 20 different user tasks which all refer to a form A (different admin groups performing the same task).

 

Now I want to have a workflow 2 which is to 90% identical to workflow 1, having about 20 different user tasks wich all refer to a form B. The difference of the form is mainly the header data and the tasks form itself.

 

Is there a way to create a copy of the existing workflow under another name (e.g. like the save as for forms or views) and use it K2 Five Designer?

 

Many thanks,

Christian

Hi,


 


Is the current workflow making use of the K2 for SharePoint? If this is the case, you can use the package deployment tool to overcome this limitation.


Save-as a new workflow option in the new K2 Five workflow designer is not currently available out of the box, you can upvote the feature on the Ideas Portal:


https://ideas.k2.com/ideas/APIT-I-519


 


Hi,

 

No, the current workflow is not makeing use of K2 for Sharepoint.

 

I found the following solution:

1. Create a new workflow with the descired name and just save it

2. In the K2 Database find the table Designer.Process

3. Identify the ProcessId of the workflow you want to copy from: SELECT * FROM Designer.Process WHERE NAME LIKE '%YourProcessName%'. Make sure that MajorNo and BuildNo are the one you want to use.

4. In the same way identify the ProcessId fo the workflow you wanted to copy to.

5. Now execute the following query UPDATE Designer.Process SET Json = (SELECT Json FROM Designer.Process WHERE Id = YourSourceProcessId) WHERE Id = YourTargetProcessId.

 

I will  not accept any liability for any issues arising from actions taken in respect of the information provided by me.

 


Hi,

 

CAUTION with my method!

 

Copying the workflow seems to be fine. In reality you cannot modify the copied version. You will get a error message: object reference not set to an instance of an object.

 

I am sorry for any trouble I may have caused.


Directly modifying the K2 database is not recommended.  A tiny mistake here could create havoc.

 

David


David, in principle you are right.

 

So I would recommend to do a backup of the K2 Database before you start doing this type modifications.

 

Amending to my solution: with the Json Data at the end there is an ObjectId. This objectId needs to have the same value as the JsonId. 

 

Then the duplicated workflow can be used and modified.

 

Thanks,

 

Christian

 

 


So I agree that directly modifying the database is a risky idea... in a non-prod environment, with a backup, it's a little less risky. That said, sometimes you need to do this copy process until we have K2 Five 5.3. Copying of workflows in coming according to ideas.k2.com.

 

I found that I had to take a few additional steps. 

1) I had to export the json result from the query in order to change the objectid. But the number of characters exceeded what SQL Management Studio would display, so I had to use the "Export Data" functionality using the select json from part of the above querey. I selected a text file to output it to. And you have to check the box for unicode. 

 

Then in a text editor, I had to do a search and replace .. find ' and replace with ''   because there are some things in the json that are quoted with a single quote and that will mess up the SQL later..

 

Replace the GUID for Object ID. You have to look at the SQL row for the destination workflow you're going to update to get the value of the JsonId column.. then paste that in.. It's the last element in the json.

 

Finally, you need to change the system name if it's a workflow that has already been deployed .. So search the text for the old name of the workflow and replace it with the new name. It will be in elements  "systemName":"<old name if it was deployed, otherwise there will be nothing here>","title":"<old name of the workflow>"

 

So far so good though.


Hey all -- saw this string, not sure if anyone has tried this method vs. messing with the database:

 

1)  Open the workflow you wish to copy

2)  When the workflow opens, the "start" step will be shown in the configuration panel

3)  Click the properties icon where the name, description and priority are shown

4)  Change the name, save and exit

 

You should see not only your original, but a version with the new name you typed in step #4.  You will need to publish this workflow to make it active, but seems to work for me (running 5.2, FP24).  

 

Granted, haven't tested this extensively... but appears to let me edit and change the workflow.  Regardless, if nothing else you're no worse off trying this before you start messing with the database (which is, as noted, a scary proposition).


Reply