I had a problem with upgrading a workflow in sharepoint having the old workflow instances working on the existing items and the new instance applicable only to the items added hence. I also had to make few changes to the infopath form to have the new form functional.
The challenge here was to make the new changes working [ new infopath form and new workflow assembly] having the old workflow assembly and items still working. Installing new workflow assembly would overwrite the existing one . Hence wasn’t a feasible solution.
1. Deploy the new form[infopath] as a content type.
2.Upgrade the logic/code in workflow as needed ,create a new version of this workflow & deploy the assembly to GAC.
3.Set the exisiting workflow to “No new instances” .
4. Attach the modified workflow to the content type [ new infopath form deployed in step 1].
In Detail :
1. Deploy the infopath form as a content type
Deploying the browser form as a content type helps us to reuse forms across site collection and also attach workflows to the content types.
Read this for versioning in infopath.
2. Upgrade workflow , create new version and deploy the assembly to GAC.
Best way of doing this is to change the workflow.xml file so that the new workflow will have a different GUID & update the assembly version . Upgrading the exisiting assembly will break the exisiting instances . Since there is no versioning concept in features, deploy this solution as a new feature .
3.Set workflow for “No New Instances”
Go to Workflow setting > Remove workflow and check “No New Instances” againsts the existing workflow . This will make sure that new items will not be effected with the old workflow instance and will be associated only with the exisiting items in a list/library.
4. Attach workflow to content type
Associate the new workflow [deployed as a feature] with the upgraged form that is deployed in step 1.
To do this go to
> Site Content type
> Click on content type to which thw workflow has to be attached.
> Workflow setting , associate workflow here .
Once we have this set up ready it can be noticied that while the old instances still keep working , the new one is applicable only to the items added to the library here after.