Orquesta - Is there way to publish Inquiries ID(Execution ID) and use it in another action?


#1

I use core.ask action in Orquesta and
I want to send mail with Inquiries ID when inquiry is not approved.

<% ctx(st2).action_execution_id %> is overall workflow execution id
I am trying to get task(get_approval) execution_id.

get_approval:
    action: core.ask
    input:
      schema:
        type: object
        properties:
          approved:
            type: boolean
            description: "approve?"
            required: True
    next:
      - when: <% succeeded() and task("get_approval").result.response.approved %>
        do: approved
      - when: <% succeeded() and task("get_approval").result.response.approved=false %>
        publish:
          - msg1: <% ctx(st2).action_execution_id %>
        do: not_approved
      - when: <% failed() %>
        do: stop

not_approved:
    action: core.sendmail body="not approved id=*****************"

Thank you


#2

I’m not sure this is supported yet in Orquesta.

@m4dcoder Can I get you to confirm one way or the other?


(Lindsay Hill) #3

You might be able to do something with rules - see Inquiries — StackStorm 2.10.2 documentation

It might be worth checking if a trigger instance is created when an inquiry is denied.


#4

@blag Thanks for your reply.
Although this problem is resolved by using rules, I think it would be better to be able to obtain the execution ID in the workflow.
Because if a lot of kind of inquiery are requested, I am concerned that condition becomes complicated to create criterias in rules.

Thanks so much for your time.


#5

@lhill Thanks for your reply.

I solve it just now by using rules.

I watch “#st2 trigger-instance list” and respond the inquiry, I found core.st2.generic.actiontrigger is created.

Then I create rule and it work well.

---
    name: "rule_when_inquiry_not_approved"
    pack: "test"
    description: "action when inquiry is not approved"
    enabled: true

    trigger:
        type: "core.st2.generic.actiontrigger"

    criteria:
        trigger.action_ref:
            pattern: "core.ask"
            type: "equals"
        trigger.result.response.approved:
            pattern: false
            type: "equals"

    action:
        ref: "core.echo"
        parameters:
            message: "Not approved. {{trigger.execution_id}}"

Thank you so much.


(W Chan) #6

I’m glad you found a workaround. Currently, the inquiries ID is not accessible from within the workflow context. I do think this is an excellent idea and something we should include in a future release.