Symptoms
I have modified an existing K2 workflow and cannot deploy it. I reloaded the version of the workflow prior to my revision and tried to deploy it and received the same error message. I am not sure what this error message is referring to:
System.NullReferenceException: Object reference not set to an instance of an object.
at SourceCode.Workflow.Authoring.K2FieldPartCollection.Add(K2FieldPart item)
at SourceCode.Workflow.Authoring.K2Field..ctor(K2FieldPartt] parts)
at SourceCode.Workflow.Design.Forms.FieldParts.FormPart..ctor(ArtifactLibraryFieldPart formsServerField, String formName, Guid formId)
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.ProcessSetup(DefaultProcessand newProcess, XmlDocument InputData, XmlDocument xmlProcess, String ProcessName, String ProjectName, String UserName)
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.Generate(String LocalHostConnection, String UserName, Int32 ProcessID, String InputData, String ProcessXML, String SqlConnectionString, String HostServerConnectionString)
Diagnoses
The issue seems to be causes by the value of current environment in the Designer web.config file is set to the wrong environment
Resolution
Which Environment Library template are you using as default to deploy your workflows i.e. Development or Production?
If you are not sure, you can check this by going to K2 Workspace-> Management(Management Console)-> tServerName]->Environment Library > Templates > Default Template > Environments which environment is currently the default?
Once you've determined the default environment library template, run through the steps outlined below:
- Navigate and locate the web.cofig file in the "eInstallDir]K2 blackpearlK2 smartforms DesignerWorkflow" folder directory
- Take a backup of this file.
- Now, edit this file using notepad or any other text editing tool of your choice locate the '' element, and change the "value" to the name of your default Environment as determined above.
- Perform an IIS reset.
- Restart the K2 blackpearl service.