23 Jun 2026
02:11 PM
- last edited on
24 Jun 2026
06:49 AM
by
MaciejNeumann
Hello,
I've a workflow with two actions. First is a JS action that returns an output like this one:
delay_seconds = 300
recipients = [
{
"to": user.one@company.com
},
{
"to": user.two@company.com
}
]
Second is an email action. It uses result("js_action")["delay_seconds"] in "wait before" option. And it uses result("js_action")["recipients"] in "loop task" option.
This works as expected. Both users receive email after a delay of 300 seconds.
Now I need to modify the workflow so that js_action returns an output like this one instead:
recipients = [
{
"delay_seconds": 300
"to": user.one@company.com
},
{
"delay_seconds": 500
"to": user.two@company.com
}
]
But with this change I'm not able to use _.item["delay_seconds"] in "wait before" option.
How can I achieve this use case? User one should receive email with delay of 300s while user two should receive email with 500s delay.
This is simplification of the real use case. I want to avoid creating 100s of workflows (1 per user or team). Instead I want user to define their preferences in ownership object and use workflow to notify them as per their preferences.
Thanks,
24 Jun 2026 01:30 AM
Hi @intact658
The "Wait before" option is evaluated once for the entire task, not per loop iteration so _.item["delay_seconds"] won't work there.
You can go with Group by delay + Run Workflow action, I mean JS action groups recipients by delay_seconds, then loop through groups using Run Workflow action to trigger a child workflow per delay group. The child workflow has the email action with "wait before" set from the input parameter.
Thanks,
Sujit
Featured Posts