I have created a state machine workflow using VS 2013,SP 2013.When i haev deployed to a document library, its thrown an err "
Error occured
when I debugged, am able to see the task list of this document library is showing NULL value. I am stuck here, with why i am getting a NULL value.While creating this workflow i already configured, selected the "workflowtasks" list as the associated task list[ NOT the normal Tasks list]. Am I doing wrong thing? by selecting this workflowtasks as the task list for this workflow? How to change the Task list of this workflow from tasks list to "Workflow Tasks" list using Visual Studio designer surface?
private void createTaskTokenfoInProgressActi_MethodInvoking(object
sender, EventArgs e)
{
createTaskWithContentType1_TaskId1 = Guid.NewGuid();
**//below line throws the error**
if (this.workflowProperties.TaskList.ContentTypesEnabled != true)
{
workflowProperties.TaskList.ContentTypesEnabled = true;
}
strworkflowName = "Document approval workflow";
//loggedinUser = workflowProperties.Web.CurrentUser.LoginName;
loggedDate = oSPListItem["InitiationDate"].ToString();
siteName = ospweeb.Title;
//workflowProperties.Site.ToString();
SPContentTypeId myContentTypeID = new
SPContentTypeId(createTaskWithContentType1.ContentTypeId);
SPContentType myContentType =
workflowProperties.Site.RootWeb.ContentTypes[myContentTypeID];
bool contenTypeExists = false;
foreach (SPContentType contentType in
workflowProperties.TaskList.ContentTypes)
{
if (contentType.Name == myContentType.Name)
{
contenTypeExists = true;
break;
}
}
// If it's not already added, then Add it to the Task Lists
Content Types