Tuesday, July 17, 2012

Importing K2 Processes from one Project to Another

If you're using K2 in your environment, a best practice is to govern the naming of both K2 Studio projects and K2 Designer for SharePoint processes. This way your K2 Workspace and process portals have some sort of order, you make process admin's lives easier, and your environment isn't the wild west as far as naming conventions go.

 

Recently due to a change in business requirements I had to rename my deployed K2 project. I created a new K2 Studio project and imported all of my deployed processes. After I validated that all of the imported processes worked in the new project, I deleted the original project from the server. When I went back into the site the next day, none of the workflows started. Trying not to panic, I looked over K2 Workspace and my process portal and couldn't see any sign of life in my processes. I quadruple checked my rights and made sure all of my ducks were in a row. 

 

Exhausted from not seeing anything in the usual troubleshooting spots, I took a peek in the server logs. By parsing the logs, it was easy to determine that the imported processes were the problem. There was constant reference to my old project every time my processes were supposed to initiate. If you open up a process in Notepad you can find that deep in the annals of the process' XML is the following: <workflowfullname>ProjectName\ProcessName</workflowfullname>. So the question is: how do you update the XML to refer to the new project?

 

Not wanting to manipulate the XML manually, a ticket was opened to K2. This doesn't seem to be documented anywhere, so I wanted to share how to get your imported processes from another project working again:

 

  • In your new project, open the process
  • Click through the SharePoint Events process wizard and click Finish
    • Note: If you're using the event wizard's XML, you do not have to remap the XML
  • Redeploy the process. The old project reference in your process will disappear and your process will start.

 

Note: This only seems to be problematic for processes built using SharePoint Events. I'm not currently using SharePoint Workflow Integration or InfoPath Integration process wizards so I can't vouch if the same issue persists.

 

One final note about importing processes from another project: if you're using an Inter Process Communication Event, be sure to update the IPC event so that it is aiming at the process in the current project.

 

Hopefully this post helps anyone wondering why their once working, imported processes don't start in their new K2 project.