Get the ID of a inquiry task using orquesta workflow

(Adam Jackson) #1

I am trying to write a orquesta workflow that using core.ask. When the users responds no/false I will like to post the of the cancelled request. I have a rule that notifies the user via slack when a notification is pending, but when a cancel is issued I would like to send a notification of the so it matches the message the rule gives. I can’t figure out is it is possible to get the in the workflow

my workflow

version: 1.0

description: A basic workflow that demonstrates inquiry.

  - action_details
  - hostname
  - file_path

    action: core.echo message="Automation started."
      - when: <% succeeded() %>
        do: get_approval

    action: core.ask
      route: <% ctx().action_details %>
        type: object
            type: boolean
            description: "Continue?"
            required: True
      - when: <%  task(get_approval).result.response.approved = true %>
        do: finish
      - when: <%  task(get_approval).result.response.approved = false %>
          - a5: <% task(get_approval).task_execution_id %>
        do: stop

    action: linux.rm hosts=<% ctx().hostname %> target=<% ctx().file_path %> private_key="/home/stanley/.ssh/id_rsa" username="centos"

    action: text='You have cancelled inquiry <% ctx().a5 %>' channel="#tools_stackstorm_2" token="redacted" 

a5 is the task execution id

I am looking for the id associated with the pending task as seen in the action output below i.e. 5cd088d1180d1f1accee9c66. Is there anyway to retrieve this in the workflow?

| id                       | status                 | task         | action    | start_timestamp               |
| 5cd088d0180d1f1accee9c63 | succeeded (1s elapsed) | start        | core.echo | Mon, 06 May 2019 19:19:43 UTC |
| 5cd088d1180d1f1accee9c66 | pending                | get_approval | core.ask  | Mon, 06 May 2019 19:19:45 UTC |
(Lindsay Hill) #2

Look at the Note just above here Inquiries — StackStorm 3.0.0 documentation

At the time of this writing, the Inquiry ID is the same as the action execution ID that raised it. So if you’re curious which workflow a given Inquiry is part of, use the same ID with the st2 execution get command.

(Lindsay Hill) #3

Also - this forum supports Markdown formatting, or you can use the formatting buttons on the text entry. I’ve edited your post to make it easier to read

(Adam Jackson) #4

I did see that in the inquiry docs. So how would I get the action execution ID in the workflow? I can only see the task_execution_id and workflow_execution_id as possibly values. I am basically looking to capture the id 5cd088d1180d1f1accee9c66 (id of the pending core.ask task) in the workflow.