How to use ForEach Actvity in Workflow designer to read list item values from customer activity #343
Unanswered
jayachandra21
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a custom activity named it as CustomActivity1 and it returns the list as below screenshow.
I have set list in SetVariable as,
**Output.SetVariable("FetchJSONVal",
_strOutput);**'Moreover, I want to use ForEach Acitivity in workflow designer to loop the above list items and check in each iteration if(EmpData.Value>EmpData.ID) then send an email
How to design it and what is the best possible approach?
Thanks for your support
CustomActivity1.cs
` [ActivityProperty(Hint = "Enter an Expression that evaluates to the name of the database connection string.")]
public WorkflowExpression ConnectionString
{
get => GetState<WorkflowExpression>();
set => SetState(value);
}
protected override async Task OnExecuteAsync(WorkflowExecutionContext context, CancellationToken cancellationToken)
{
try
{
var sqlconnectionString = await context.EvaluateAsync(ConnectionString, cancellationToken);
List _strOutput = await FetchDataAsync(sqlconnectionString, cancellationToken);
Output.SetVariable("FetchJSONVal", _strOutput);
}
catch (Exception ex)
{
throw ex;
}
return Done();
}
private Task<List> FetchDataAsync(string _connectionstring, CancellationToken cancellationToken)
`
Beta Was this translation helpful? Give feedback.
All reactions