# How do I format a DQL Query into Adaptive Cards properly - Workflows

**URL:** <https://community.dynatrace.com/t/how-do-i-format-a-dql-query-into-adaptive-cards-properly-workflows/46339>\
**Category:** Developer Q&A Forum\
**Tags:** dql, coding-assistance, workflows\
**Created:** [June 27, 2024, 11:50am UTC](https://community.dynatrace.com/t/how-do-i-format-a-dql-query-into-adaptive-cards-properly-workflows/46339 "2024-06-27T11:50:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![badgerfifteen](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@badgerfifteen](https://community.dynatrace.com/u/badgerfifteen)\
**Post date:** [June 27, 2024, 11:50am UTC](https://community.dynatrace.com/t/how-do-i-format-a-dql-query-into-adaptive-cards-properly-workflows/46339/1 "2024-06-27T11:50:43Z")

</div>

From a high-level point of view, I need a workflow which grabs a DQL query of disk free as a percentage and then sends that as a Teams message.

This is what I have as my first flow (the DQL query)

```markup
timeseries percent = avg(dt.host.disk.used.percent), by: { dt.entity.host, dt.entity.disk }, filter: { in(dt.entity.host, classicEntitySelector("type(host),tag(\"Business Unit:FINANCE_DEPT\")")) }
| fields util = arrayAvg(percent), entityName(dt.entity.host)

```

It will then output this in a raw JSON format with the function get\_disk\_stats\_title.records

```markup
[{"util":37.81379436933137,"dt.entity.host.name":"exampleserver_1"},{"util":0.48663042982483673,"dt.entity.host.name":"WNCDKS01.corp.net"},{"util":49.254119519423064,"dt.entity.host.name":"WNBX103.corp.net"},{"util":37.62645628433896,"dt.entity.host.name":"exampleserver_4"},{"util":69.18935581114691,"dt.entity.host.name":"exampleserver_5"},{"util":71.16928194761574,"dt.entity.host.name":"exampleserver_6"},{"util":40.62837394704024,"dt.entity.host.name":"exampleserver_7"}]

```

Im trying to use the adaptive cards but not sure how to format it to generate a human-readable card?

---

<div class="post-metadata">

**Author:** ![educampver](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/educampver/32/29917_2.png) [@educampver](https://community.dynatrace.com/u/educampver)\
**Post date:** [June 28, 2024, 8:05am UTC](https://community.dynatrace.com/t/how-do-i-format-a-dql-query-into-adaptive-cards-properly-workflows/46339/2 "2024-06-28T08:05:31Z")

</div>

Hi&nbsp;[@badgerfifteen](https://community.dynatrace.com/user/67521), I’m not sure I fully understand you question, but I guess it’s about how to use the AdaptiveCards SDK in Workflows, is that right? If so,&nbsp;you can load it from a JavaScript CDN like esm.sh:

```javascript
import * as AdaptiveCards from 'https://esm.sh/adaptivecards@3.0.4';

export default async function ({ execution_id }) {
  const adaptiveCard = new AdaptiveCards.AdaptiveCard();
  // ...
}

```

You just have to make sure that esm.sh is&nbsp;[allow-listed from your tenant](https://developer.dynatrace.com/preview/develop/functions/allow-outbound-connections/).

---

<div class="post-metadata">

**Author:** ![PennyScully](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pennyscully/32/32029_2.png) [@PennyScully](https://community.dynatrace.com/u/PennyScully)\
**Post date:** [July 2, 2024, 6:33am UTC](https://community.dynatrace.com/t/how-do-i-format-a-dql-query-into-adaptive-cards-properly-workflows/46339/3 "2024-07-02T06:33:14Z")

</div>

Hi&nbsp;[@badgerfifteen](https://community.dynatrace.com/user/67521)

I hope the solution above solution worked for you, if so, please ‘accept as solution’, to help us close this community question.

Thanks, Penny
