# Update variable values on new Dashboard using workflow task

**URL:** <https://community.dynatrace.com/t/update-variable-values-on-new-dashboard-using-workflow-task/51320>\
**Category:** Dashboarding\
**Tags:** dql, workflows, dashboards\
**Created:** [April 22, 2025, 10:01am UTC](https://community.dynatrace.com/t/update-variable-values-on-new-dashboard-using-workflow-task/51320 "2025-04-22T10:01:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![heramb\_sawant](https://avatars.discourse-cdn.com/v4/letter/h/c4cdca/32.png) [@heramb\_sawant](https://community.dynatrace.com/u/heramb_sawant)\
**Post date:** [April 22, 2025, 10:01am UTC](https://community.dynatrace.com/t/update-variable-values-on-new-dashboard-using-workflow-task/51320/1 "2025-04-22T10:01:02Z")

</div>

Hi ,  
I have new dashboard(not the classic), dashboard has tile shows metric data&nbsp; i.e disk utilization based on parameter passed to to DQL. .

Dashboard tiles shows disk utilization based on host names passed in DQL ,&nbsp;I wan to update this tile input&nbsp;($Host\_Name) i.e. values of ‘Host name’ from workflow. Workflow having task which gives me list&nbsp; of host which has threshold violation.

So&nbsp; 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

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [April 24, 2025, 7:46pm UTC](https://community.dynatrace.com/t/update-variable-values-on-new-dashboard-using-workflow-task/51320/2 "2025-04-24T19:46:09Z")

</div>

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.

```javascript
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;

}

```
