# Delay send email action based on a variable input

**URL:** <https://community.dynatrace.com/t/delay-send-email-action-based-on-a-variable-input/56263>\
**Category:** Automations\
**Tags:** problem-notification, workflows\
**Created:** [June 23, 2026, 1:11pm UTC](https://community.dynatrace.com/t/delay-send-email-action-based-on-a-variable-input/56263 "2026-06-23T13:11:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![intact658](https://avatars.discourse-cdn.com/v4/letter/i/47e85d/32.png) [@intact658](https://community.dynatrace.com/u/intact658)\
**Post date:** [June 23, 2026, 1:11pm UTC](https://community.dynatrace.com/t/delay-send-email-action-based-on-a-variable-input/56263/1 "2026-06-23T13:11:40Z")

</div>

Hello,

I’ve a workflow with two actions. First is a JS action that returns an output like this one:

```markup
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&nbsp;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:

```javascript
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&nbsp;\_.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,

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [June 24, 2026, 12:30am UTC](https://community.dynatrace.com/t/delay-send-email-action-based-on-a-variable-input/56263/2 "2026-06-24T00:30:56Z")

</div>

Hi&nbsp;[@intact658](https://community.dynatrace.com/user/57588)

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

---

<div class="post-metadata">

**Author:** ![sonja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sonja/32/10349_2.png) [@sonja](https://community.dynatrace.com/u/sonja)\
**Post date:** [July 3, 2026, 9:58am UTC](https://community.dynatrace.com/t/delay-send-email-action-based-on-a-variable-input/56263/3 "2026-07-03T09:58:33Z")

</div>

Hello&nbsp;[@intact658](https://community.dynatrace.com/user/57588)&nbsp;!

I’m curious about the real use case - could you share more details? that might help us suggest additional options.

thanks!  
Sonja
