Task.Save(true) throws NullReferenceException

Vote:
 

I am programmatically creating a task from within a workflow running in episerver CMS 6 R2. Each time I call Task.Save(true) it throws a null reference exception. Task.Save(false) works ok but of course doesn't send out a notification to the role members. I have checked that all role members have an email address and have tried assigning the task to an individual user as well however the problem persists. We're using a multiplexing membership provider, the role and all users are defined in the SqlMembershipProvider.

            var task = new Task();
            task.Description = "Approve competition entry";
            task.AssignedTo = "Testing";
            task.AssignedIsRole = true;
            task.Subject = "Approve competition entry";
            task.DueDate = DateTime.Now.AddDays(1);
            task.WorkflowInstanceId = this.WorkflowInstanceId;
            task.Save(true);

I'd also like to know how to link the task to a particular page but I can't find any clues on how to do this anywhere.

Can anyone help me out here?

 

#52319
Jul 18, 2011 18:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.