Hi,
I am using VS 2010 and SharePoint 2010
I have a contenttype created with Id starting with "0x01080100" and AllowInherit set to false.
I created a custom Task list with list instance = 107 and added this content type. The newly created content type is not the default content type of the list. But in the List settings, I can see the content type. AllowManagementofContentType is set to true in task list
I added a sequential workflow, added a workflow activation event and then added createtaskwithcontenttype.
In the contenttype i associated the content type id. Set the Task Id and TaskProperties. In the invoke event, i have the below code:
private void createTaskforManager_MethodInvoking(object sender, EventArgs e)
{
this.ManagerTaskId = Guid.NewGuid();
this.TaskPropertiesForManager.PercentComplete = (float)0.0;
this.TaskPropertiesForManager.Title = "Please Review: " ;
this.TaskPropertiesForManager.AssignedTo = "domain\Id";
this.TaskPropertiesForManager.SendEmailNotification = false;
}
I am getting Object reference not set error, after the method is completed.
Below is the stack trace :
at Microsoft.SharePoint.Workflow.SPWorkflowSubscriptions.AddEventReceiverCallback(SPEventReceiverDefinition eventReceiverDefinition, SPList contextList) at Microsoft.SharePoint.SPEventReceiverDefinitionCollection.Add(Guid Id, SPList contextList) at Microsoft.SharePoint.Workflow.SPWinOEItemEventReceiver.CreateListItemSubscription(Guid subscriptionId, SPWorkflow workflow, SPList list, Guid channelTypeId, Guid dynamicCorrelationId, Guid listItemGuid, Guid subEventType, SPEventReceiverType rt, String assemblyName, String className, String eventName, Int32 itemId, Boolean fReserveId) at Microsoft.SharePoint.Workflow.SPWinOETaskService.CreateSubscription(MessageEventSubscription sub) at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CreateSubscription(MessageEventSubscription sub) at System.Workflow.Activities.CorrelationTokenInvalidatedHandler.CreateSubscription(Guid instanceId, ActivityExecutionContext context, ICollection`1 correlationValues)
I have checked these links:
I have also tried manually setting the custom content type as default.
The correlationId for workflowactivation and manager task creation are different.
Update : Found that this issue is not because of the content type or the task list. I deployed the same another site collection and it worked. However, I am not sure, why this error is shown in a different site collection? Both are Team sites.
In both the sites, 90% of the time I am getting the error, 10% of the time it works.
I have tried disable and enabling the workflow. But the Issue persists.
How to fix this?
Thanks
No comments:
Post a Comment