Symptoms
Packaging and deploying K2
Diagnoses
I need to package up a solution in PROD environment for client and deploy it to their UAT to match the two environments. This solution was deployed by someone else approximately 2 years ago and I don't have the details of how they did it as they since left the company. From what I can see, there's a K2 solution for sharepoint - a set of smartforms attached to sharepoint libraries with associated smart objects. The workflow looks like it has been developed and deployed using K2 Studio rather than the designer. If I try to package via Sharepoint it reports an error because it can't find the workflow. It reports a broken reference. I was able to download the workflow from workspace and open it in K2 studio. If I try to package the whole lot with packaging and deployment tool it also reports broken references. Looks like it has a pointer to the workflow but reports the reference as broken. I tried packaging just the smartforms and objects together and workflow separately from K2 studio. When I try to deploy that it doesn't work either - the workflow wont deploy from K2 studio because it expects the smartforms to be there and the smartforms won't deploy via packaging and deploy studio because they expect certain workflow settings to be present in the sharepoint library. Seems like catch 22 or some sort of circular dependency.
Resolution
1. The lists and libraries were created in UAT - I used powershell backup and restore commands to restore the whole site so it's exactly like the one in production 2. Created K2 solution on the target library then deleted all artefacts from it (in the next step they're deployed from a package) 3. packaged up forms andamp views only then deployed that to UAT - this step is a clunky as nearly all artefacts has broken references reported so I manually picked each and remapped to various sharepoint lists and such) 4. Opened the workflow in text editor and replaced all occurrences of "smartforms runtime 1" to just "smartforms runtime" - for some reason the existing setting worked fine and the old one never got created 5. Opened the workflow in K2 studio 6. Had to re-run nearly every wizard in the process to re-map the references and point the URLs to UAT equivalents. In the process this created multiple references. Looks like old broken references don't get removed by the designer. This was painfully clunky process and it took me a couple of hours. 7. Could successfully deploy workflow