28 Oct 2024 04:12 PM - last edited on 29 Oct 2024 07:17 AM by MaciejNeumann
My code is not returning anything to the log, I think I am following the proper format, must be something I am missing?
Note: Format taken from - https://docs.dynatrace.com/docs/platform-modules/automations/workflows/default-workflow-actions/run-...
Note: The previous task which completes successfully is - "get_unhealthy_workers"
import { execution } from '@dynatrace-sdk/automation-utils';
import { eventsClient } from "@dynatrace-sdk/client-classic-environment-v2";
export default async function ({ execution_id }) {
var ex = await execution(execution_id);
var getunhealthyworkers = await ex.result('get_unhealthy_workers');
console.log('The whole result object: ', getunhealthyworkers.alertText);
}
The log from the execution:
The whole result object: undefined
Solved! Go to Solution.
29 Oct 2024 01:54 PM
The code looks ok, could you verify the task get_unhealthy_workers actually has a result?
You can check that in an execution by looking at the result tab of the task details, example:
04 Nov 2024 10:38 AM
Thanks, I had forgotten to make sure return worked, simple fix.