How to run run a action dynamically in orquesta workflow

I’m trying to run a job dynamically. Below is part of my workflow

  • when: “{{ succeeded() }}”
    publish:
    - env: “{{ result().result.env }}”
    - job: “{{ result().result.job }}”
    - color: “{{ result().result.color }}”
    do:
    - <% ctx(job) %>

but I’m getting below exception. Instead of <% ctx(job) %> I tried “<% ctx(job) %>”, <% ctx.job() %>, “<% ctx().job %>”

  • message: The task “<% ctx(job) %>” is not defined.
    schema_path: properties.tasks.patternProperties.^\w+$.properties.next.items.properties.do
    spec_path: tasks.parse_datadog_event.next[0].do
    type: semantic

See here: Dynamic action workflows pattern

This is not supported. The tasks defined to run next in do must be explicit. The workflow engine does validation before running the workflow and so the execution paths must be predetermined.

it would be great if tasks can be ran dynamically.

This is in conflict to our core concept for our workflow engine which requires task and transition to be defined explicitly.

got it. Thanks for the quick response @m4dcoder

@m4dcoder couldn’t one just have more than one when And have different tasks based on the conditional and get the same outcome? Or at least for repeatable cases?

@punkrokk What you described is different than what I understand from the original question here? You can certainly have multiple when in the task transition and do different task depending on condition. This is still fairly static. The original question here is if the do can also be dynamically assigned at runtime with an expression.