none
Multiple tasks in Replicator in projectSequence RRS feed

  • Question

  • Hi,

    I want to create workflow which will start on creating new project (Project Server 2010, Sharepoint 2010). The workflow should create approval tasks for group of users. Count of users in group may change. So, I use ReplicatorActivity and set InitialChildData to this group. Inside Replicator I have a createTaskActivity which creates tasks for each user in the group. I follow the microsoft tutorial on msdn "Creating Multiple Tasks from a SharePoint 2010 Workflow":

    http://msdn.microsoft.com/en-Us/library/hh128696%28v=office.14%29.aspx

    and it's working fine. My workflow diagram is equal to tutorial diagram.

    In Replicator ChildInitialized method I set properties for approval tasks which I pass in TaskActivity

     private void replicateTasks_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            spTaskActivity1.TaskTitle = "New Project Approve";
            spTaskActivity1.TaskDescription = "Approve the project";
            spTaskActivity1.TaskAssignedTo = e.InstanceData.ToString();
            spTaskActivity1.TaskDueDate = DateTime.Today.AddDays(7);
        }
    

    In TaskActivity I set this properties for task on creating

      private void CreateApprovalTask_Invoking(object sender, EventArgs e)
        {
            //Create Task
            TaskId = Guid.NewGuid();
            TaskProp.Title = TaskTitle;
            TaskProp.Description = TaskDescription;
            TaskProp.AssignedTo = TaskAssignedTo;
            TaskProp.StartDate = DateTime.Today;
            TaskProp.DueDate = TaskDueDate;
        }
    

    All works. Tasks are created and all it's properties are correct and not empty.

    Problems appeared when I add projectSequence in my workflow and move the ReplicatorActivity inside it, because I want the workflow will start on project creating. In this case workflow started on project creating and replicator creates tasks with empty properties! Number of tasks is correct and equal to users count.

    On debugging I see that all properties are null, although ChildInitialized method has been executed.

    What I'm doing wrong?

    Thanks


    • Edited by SunFiery Thursday, April 17, 2014 6:31 AM
    Thursday, April 17, 2014 6:28 AM

All replies