07 Aug 2025 11:57 AM
Hi,
I have workflow with 4 tasks that run one after another . Currently this workflow task's various information for particular application , I want to run the same workflow for multiple applications. How can I run it in loop or is there any workaround.
Regards,
heramb Sawant
07 Aug 2025 01:25 PM
Check out running a Workflow from a Workflow (sub-Workflows): Run workflow action for Workflows — Dynatrace Docs
07 Aug 2025 04:32 PM
Hello @heramb_sawant ,
First of all, add a task to generate your applications list.
Afterwards, create a child task and use the Loop Task option by adding the List related to the previous task and use a item variable name :
And finally you can use {{ _.item }} or in case of the Run JavaScript action, you can use loopItem function to access the item in each iteration :
Regards Aurélien.
18 Aug 2025 03:09 PM
Hi
I built 2 workflows
workflow 1 - having "run workflow" task . In loop task, there is item variable name "item" and its value is json object i.e.
[{
"cluster" : "Cluster1",
"namespace" : "namespace1"
},
{
"cluster" : "Cluster2",
"namespace" : "namespace2"
}
]
This workflow calling another workflow i.e workflow2.
Here in workflow2 , I am trying to print item values of workflow 1 but getting error in javascript code.
console.log(loopItemValue.value);
error : can not read properties of null(reading 'value)
Please correct me
18 Aug 2025 03:45 PM
Hello @heramb_sawant
You should use something like that :
// import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function ({ loopItemValue }) {
// load the execution object using the current loopItemValue
const exe = await execution(loopItemValue);
const checkResult = await exe.result('workflow1');
const json = checkResult['json'];
// APPELER L'ATTRIBUT NAME
console.log('Cluster : ', json.cluster);
console.log('Namespace : ', json.namespace);
}
Regards Aurélien
18 Aug 2025 03:59 PM
getting error in workflow2,
define_application_details:
Uncaught (in promise) 404: Task run_workflow_1 does not exist.
here "run_workflow_1 " is task from workflow 1. I tried with workflow1 names but same error
18 Aug 2025 04:05 PM
I’m not sure I fully understand what you mean.
You’re talking about a “workflow 1” and a “workflow 2,” whereas I’m referring to "tasks" within the same workflow.
In my case, you run check-result on the previous task name, which returns the JSON.
Regards
18 Aug 2025 05:25 PM
I am trying to call workflow 2 from workflow 1.
Workflow 1 has task that calls workflow 2. This task also has loopitem i.e. "item" having json object as value.
Then trying to access this loopitem values in workflow 2 but getting error.
19 Aug 2025 07:58 AM
Any help will be appreciated.
19 Aug 2025 09:01 AM
Ok, so to assist you further,
Export your workflow as a template (make sure it doesn’t contain any personal data),
Or Take a screenshot of Workflow 1 and another screenshot of the results of the task that calls Workflow 2.
20 Aug 2025 08:35 AM
Hi ,
Please find the SS for your reference.
workflow 1 has task "run_workflow_1" having input values
results of the task that calls Workflow 2:
I want to receive input values in workflow 2.
20 Aug 2025 08:59 AM
Ok, I understand your need better.
I have never experimented with this, but in my opinion you need to add {{ _.item }} in your input:
And you must use the input() expression in the sub-workflow :
Sources:
Regards
20 Aug 2025 10:08 AM
how to use this {{ input('language') }} {{ input('topic') } in javascript task of sub workflow i.e workflow2
20 Aug 2025 06:44 PM
any help regarding receiving input values in JS task would be appreciated.
21 Aug 2025 07:08 PM
Hi,
Any help to receive input values from one workflow to another workflow