22 Apr 2025
11:01 AM
- last edited on
13 May 2025
07:29 AM
by
Michal_Gebacki
Hi ,
I have new dashboard(not the classic), dashboard has tile shows metric data i.e disk utilization based on parameter passed to to DQL. .
Dashboard tiles shows disk utilization based on host names passed in DQL , I wan to update this tile input ($Host_Name) i.e. values of 'Host name' from workflow. Workflow having task which gives me list of host which has threshold violation.
So on Dashboard , want to show disk % of of those host which has threshold violation. Can I used js code to update dashboard tile's dql query.
Regards,
Heramb
Solved! Go to Solution.
24 Apr 2025 08:46 PM
I was able incorporate workflow results in a dashboard through the use of a code tile and I imagine something similar would be possible for a variable. You would do this by doing a 'code' variable that retrieves the output from the most recent execution of the workflow. Here's the code from my dashboard tile to help you get started.
import { executionsClient } from "@dynatrace-sdk/client-automation";
export default async function () {
// Get the last successful execution
const workflow_executions = await executionsClient.getExecutions({
workflow: "<WORKFLOW_ID_HERE>",
ordering: "-endedAt",
state: "SUCCESS"
});
const last_execution = workflow_executions.results[0].id;
// fetch results from the workflow task
const task_result = await executionsClient.getTaskExecutionResult({
executionId: last_execution,
id: "<WORKFLOW_STEP_NAME_HERE>"
});
return task_result;
}