0

I want to create workflow which will start on creating new project. 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 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?

SunFiery
  • 1
  • 1

1 Answers1

0

Is replicator ExecutionType Parallel? If so, I guess you should create a custom activity with all properties inside it and then place it into replicator. It works for me, but I'm still looking for another approach without building custom activity.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Rich Sep 11 '14 at 06:46
  • If someone know better solution why not answer here? So, in that case I think my approach (workaround) is better way to solve the problem. I perfectly understand what author means, because I faced with this problem too. – Vladimir Titkov Sep 11 '14 at 07:54