views:

196

answers:

1

I am using a while activity for creating multiple tasks for a workflow. The code is executed fine and the task is created when the loop runs only once. But when the loop runs twice or more, only one task is getting created. Also the WF status shows as Error Occured.

All I want to do here is create multiple tasks (no of tasks depends on an entered column value) for the same user. Is it posible to use 'while' in this scenario? Or is there any other way to go ahead?

NB: I am using state machine workflow.

A: 

You may want to use a Replicator Activity which will in turn "clone" its child-activities. It can be run parallel or sequentially.

I found Working with the Replicator Activity and an Until Condition useful.

Otherwise without the Replicator, there is just one Task Activity.

In either case, make sure to assign a new Guid to the TaskId property. However, as an annoying "feature": it will not work if you just assign the TaskId property (I know, I tried and was like "Wth?!?"). Instead, bind the TaskId to a Field/Property and then assign to that.

pst
Hi, Did U try this in State Machine workflow or Sequential WF? I have 'heard' Replicator won't work with State Machine workflow
Georgil Mathew
@Georgil I have only used the replicator within a Sequential WF.
pst