cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to access previous tasks output for javascript task

rseibert1
Participant

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

2 REPLIES 2

ChristopherHejl
Dynatrace Advisor
Dynatrace Advisor

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:

ChristopherHejl_0-1730210081339.png

 

Thanks, I had forgotten to make sure return worked, simple fix.

Featured Posts