# Using 1 action's output result in another action

**URL:** <https://discuss.elastic.co/t/using-1-actions-output-result-in-another-action/355136>\
**Category:** Elasticsearch\
**Created:** [March 11, 2024, 9:10am UTC](https://discuss.elastic.co/t/using-1-actions-output-result-in-another-action/355136 "2024-03-11T09:10:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seemant\_Bind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seemant_bind/32/107045_2.png) [@Seemant\_Bind](https://discuss.elastic.co/u/Seemant_Bind)\
**Post date:** [March 11, 2024, 9:10am UTC](https://discuss.elastic.co/t/using-1-actions-output-result-in-another-action/355136/1 "2024-03-11T09:10:24Z")

</div>

Hi all,  
I am trying to extract the value from one action output and I want to use that result in the another action block. I am using the below watcher script to extract the value but with this I am not able to get the desired result.

```auto
{
  "trigger": {
    "schedule": {
      "interval": "5m"
    }
  },
  "input": {
    "search": {
      "request": {
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "filter": {
                "range": {
                  "datetime": {
                    "gte": "{{ctx.trigger.scheduled_time}}||-5m",
                    "lte": "{{ctx.trigger.scheduled_time}}",
                    "format": "strict_date_optional_time||epoch_millis"
                  }
                }
              }
            }
          }
        },
        "indices": [
          "abc"
        ]
      }
    }
  },
  "condition": {
    "script": {
      "source": "if (ctx.payload.hits.total > params.threshold) { return true; } return false;",
      "params": {
        "threshold": 100
      }
    }
  },
  "actions": {
    "email_admin": {
      "email": {
        "profile": "standard",
        "from": "abc@abc.com",
        "to": ["xyz.lmn@abc.com"],
        "subject": "Test",
        "body": {
          "text": "Test for body"
        }
      }
    },
    "email_body_text": {
      "email": {
        "profile": "standard",
        "from": "abc@abc.co",
        "to": ["xyz.lmn@abc.com"],
        "subject": "Body Text from Previous Action",
        "body": {
          "text": "{{ctx.payload.actions.email.message.body.text}}"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 8, 2024, 9:10am UTC](https://discuss.elastic.co/t/using-1-actions-output-result-in-another-action/355136/2 "2024-04-08T09:10:56Z")

</div>

Closed on April 8, 2024, 9:10am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
