I have developed & deployed a workflow using vs2005. For the
initiation form i'm using the ASPX forms (Not Infopath)
After all setup, the initiation form is shown in the SP site when i
start the workflow. But when submitting the Initiation form i get the
error.
below is my code
Guid listID =3D new Guid(Request.QueryString["List"]);
int itemID =3D Convert.ToInt32(Request.QueryString["ID"]);
SPSite ospSite =3D new SPSite(SPContext.Current.Site.Url);
SPWeb ospWeb =3D ospSite.OpenWeb();
ospSite.AllowUnsafeUpdates =3D true;
ospWeb.AllowUnsafeUpdates =3D true;
SPList ospTaskList =3D ospWeb.Lists["Tasks"];
SPList ospHistoryList =3D ospWeb.Lists["Workflow History"];
SPListItem ospListItem =3D
ospWeb.Lists[listID].Items.GetItemById(itemID);
SPWorkflowTemplateCollection templateColl =3D
ospSite.WorkflowManager.GetWorkflowTemplatesByCategory(ospWeb, null);
SPWorkflowTemplate ospwfTemplate =3D
templateColl.GetTemplateByName("OBSWF",
System.Globalization.CultureInfo.CurrentCulture);
SPWorkflowAssociation spwfAssociation =3D
SPWorkflowAssociation.CreateListAssociation(ospwfTemplate,
ospwfTemplate.Name, ospTaskList, ospHistoryList);
ospSite.WorkflowManager.StartWorkflow(ospListItem,
spwfAssociation,"Organice Batch");
I get the below error
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
btnSubmit_Click ::System.ArgumentNullException: Value cannot be null.
at
Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(SPListIte=
=AD
m
item, SPFile file, SPWorkflowAssociation association, SPWorkflowEvent
startEvent, Boolean bAutoStart, Boolean bCreateOnly)
at
Microsoft.SharePoint.Workflow.SPWorkflowManager.<>c__DisplayClass1.<StartWo=
=AD
rkflow>b__0()
at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object
state)
at
Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileg=
=AD
es>b__2()
at
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevat=
=AD
ed
secureCode)
at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback
secureCode, Object param)
at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
secureCode)
at
Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem
item, SPWorkflowAssociation association, SPWorkflowEvent startEvent,
Boolean bAutoStart, Boolean bCreateOnly)
at
Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem
item, SPWorkflowAssociation association, String eventData, Boolean
isAutoStart)
at _Default.btnSubmit_Click(Object sender, EventArgs e)
Note : When i start the Workflow, i get the TemplateID in the Url
which is different from the ID that mentioned in my Workflow.xml. If
this
is the problem then what is the solution for this? If not please let
me know what is wrong?
Thanks