How get the Action ID in script

Hi,

In the Watcher, I have two actions which output to Slack. In the payload send to Slack, I want to inside the current Action ID. But I don't find a var contain the action id in the ctx.
I want get the ID of the action which is calling the transform.

Can get the Action ID from the context? Or, I have to write it in the script of the transform in each action?

Thanks.

Hey,

the action id cannot be retrieved from the context currently, as the actions cannot enrich the context. A script transform would indeed solve this (or of course just hard coding in the action itself).

--Alex

Hi, @spinscale

Thank for your answer.
Your means I can get the Action ID in the transform which include the action?
How do it :smile:
May you post a sample?

Hey,

sorry if I was not clear. There is no way to do this, you need to do it manually, like this

"transform" : {
  "script" : "def payload = ctx.payload ; payload.action = 'your_action_name' ; return payload"
}

--Alex

Thank you @spinscale

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