workflow-core icon indicating copy to clipboard operation
workflow-core copied to clipboard

Call more UserTask in a foreach loop

Open Mythos1979 opened this issue 6 years ago • 3 comments

Hi, I'm using a foreach condition to iterate a collection by a certain step (LivOperativo1_RicOfferte). For each iteration I want to add the current element of iteration (1,2,3 or 4) in the 'prompt' variable of the UserTask create. It's possible?

Under my test code:

public void Build(IWorkflowBuilder<Processo> builder) { builder .StartWith<StartWorkflow>()
.ForEach(list => new List() { 1,2,3,4}) .Do(then => then.StartWith<LivOperativo1_RicOfferte>() .Input(step => step._processo, data => data) .Input(step=> step.Item, (list, context) => context.Item) .UserTask( "Task number:" + "[1] or [2] or [3] or [4]" , assigner: data => "USER/User1") .WithOption("YES", "Complete").Do(then2 => then2 .StartWith(context => Console.WriteLine("Task Complete" + Environment.NewLine))) ) .Then<EndWorkflow>(); }

Thanks Massimo

Mythos1979 avatar May 16 '19 13:05 Mythos1979

Currently, the parameter for the prompt does not take an expression... that is something we'd have to add.

danielgerlag avatar May 25 '19 21:05 danielgerlag

is there any way by which we can achieve multi user tasks, I tried to create, multiple tasks in the loop, tasks are created, but user remain same, unable to understand, I assign the user. also I am getting mails for two different user, when I see pending user tasks there are two tasks but all the values are same so it is bit confusing. @danielgerlag need your help

sunilsoniudaipur avatar Apr 08 '21 11:04 sunilsoniudaipur

@danielgerlag

I also need your help on this issue.

How to generate multiple user tasks in a loop, and the assigner is from foreach item. ` .ForEach(x=> x.Users) .Do(x=> x .StartWith(_=> ExecutionResult.Next() ) .UserTask("approve", d=> context.item) )

`

Tks.

ihuangxing avatar Jan 18 '22 15:01 ihuangxing