Skip to main content


 

Symptoms


Issue:
The client wants to Delete Workflow Definition from K2 Server, using API code

Diagnosis:
Provided the API code below, which resulted with an error in the catch statement (error:
"Default version cannot be deleted.")
 

Diagnoses


Please use this Dll andgtandgt BinSourceCode.Workflow.Management.dll

The below method:

Method:
public bool DeleteProcessDefinition(string procFullName, int version, bool deleteLogEntries)


This is due to the way the client wrote their code, you will notice something similar in Workspace, you cant select to delete the selected version if the selected version is the default version, the option will be grayed out.
 

Resolution


Resolution:
The client used the following code to delete the workflowProcess:
if (option == "1") //Delete a specific version (version : procVersion)
svr.DeleteProcessDefinition(proc.FullName, int.Parse(procVersion), true)
else if (option == "2") //Delete all versions except the default
svr.DeleteProcessDefinition(proc.FullName, -1, true)
else if (option == "3") //Delete all the versions including the default
svr.DeleteProcessDefinition(proc.FullName, 0, true)

 




 
Be the first to reply!

Reply