Hi,
I have a SharePOint workflow created using VS 2008. I have a custom association form attached with this workflow.
I uploaded this workflow in development and test environment and it does not throw any error. But in production the workflow runs fine sometime, and throws error sometime. Not sure why. we have 2 front ends, 1 app server and 1 database server. Willl this be an issue. In tese server, everythign is in one machine.
Sometimes workflow starts with no errors and sometimes workflow throws an error saying "Object reference not set to an instance of an object". Not sure why. Is there any Cache problem.
Code for Workflow.xml
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="Requisition"
Description="This will start Requisition Form Approval Process."
Id="5f8aec6e-9b2b-42d0-8ece-6a33fe270cd1"
CodeBesideClass="Requisition.Workflow1"
CodeBesideAssembly="Requisition, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8168f27a146c060b"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
AssociationUrl="_layouts/CstWrkflIP.aspx">
<Categories/>
<MetaData>
<Association_FormURN>urn:schemas-microsoft-com:office:infopath:AssociationForm:-myXSD-2010-07-04T19-32-52</Association_FormURN>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task0_FormURN>
<Task1_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task1_FormURN>
<Task2_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task2_FormURN>
<ExtendedStatusColumnValues>
<StatusColumnValue>$Resources:ReviewFeedback_CanceledStatus</StatusColumnValue>
<StatusColumnValue>$Resources:ReviewFeedback_ApprovedStatus</StatusColumnValue>
<StatusColumnValue>$Resources:ReviewFeedback_RejectedStatus</StatusColumnValue>
</ExtendedStatusColumnValues>
</MetaData>
</Workflow>
</Elements>
Code for Workflow.cs file where I am accessing association form data:
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
try
{
XmlSerializer serializer = new XmlSerializer(typeof(RequisitionForm)); // RequisitionForm is source file of "Custom Infopath Requisition form schema fil attached to Sharepoint forms library"
// Get the List Item which the workflow is executing from
SPListItem thisItem = workflowProperties.Item;
// Get the "File" which is stored in the library
SPFile thisFile = thisItem.File;
byte[] stream = thisFile.OpenBinary();
MemoryStream memStream = new MemoryStream(stream);
long pos = memStream.Position;
memStream.Position = 0;
StreamReader reader = new StreamReader(memStream);
string str = reader.ReadToEnd();
memStream.Seek(0, SeekOrigin.Begin);
XmlDocument doc = new XmlDocument();
doc.Load(memStream);
XmlTextReader rdrMyFields = new XmlTextReader(new System.IO.StringReader(doc.InnerXml));
RequisitionForm fields = (RequisitionForm)serializer.Deserialize(rdrMyFields);
// get the association data
string associationDataXml = workflowProperties.AssociationData;
AssociationForm associationFormData = Requisition.Helper.DeserializeAssociationData(associationDataXml);
//changes here
Person[] Approvers = associationFormData.Approvers;
CCNames = associationFormData.ccNames;
//accFormReqDescription
accFormReqDescription = associationFormData.message;
code goes like this....................
}...
Any help is appreciated. Thanks in advance