# Create a custom metrics from DQL query and send a message on Microsoft Teams

**URL:** <https://community.dynatrace.com/t/create-a-custom-metrics-from-dql-query-and-send-a-message-on-microsoft-teams/54839>\
**Category:** Automations\
**Tags:** dql, dynatrace-managed, notifications, workflows\
**Created:** [February 2, 2026, 11:27am UTC](https://community.dynatrace.com/t/create-a-custom-metrics-from-dql-query-and-send-a-message-on-microsoft-teams/54839 "2026-02-02T11:27:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mardock](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Mardock](https://community.dynatrace.com/u/Mardock)\
**Post date:** [February 2, 2026, 11:27am UTC](https://community.dynatrace.com/t/create-a-custom-metrics-from-dql-query-and-send-a-message-on-microsoft-teams/54839/1 "2026-02-02T11:27:13Z")

</div>

Hi everyone,I’m looking for guidance on how to create a custom metric in Dynatrace with DQL query&nbsp; and then use the result to send a notification/post to Microsoft Teams  
If you have examples, best practices, or links to relevant documentation, I’d really appreciate it.Thanks in advance!  
Mardock

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [February 2, 2026, 3:59pm UTC](https://community.dynatrace.com/t/create-a-custom-metrics-from-dql-query-and-send-a-message-on-microsoft-teams/54839/2 "2026-02-02T15:59:47Z")

</div>

Hi,  
I think that you&nbsp;can’t directly “push” the result of a DQL query to Microsoft Teams, but&nbsp;There are two supported ways to achieve this in Dynatrace, depending on whether you really need a stored custom metric or just want to use DQL results to post to Teams.  
If your DQL is based on logs,&nbsp;create a log metric using DQL matchers, then alert on that metric using Metric events, and finally send the notification to Microsoft Teams.  
1.&nbsp;Settings → Log Monitoring → Metrics extraction → Add log metric). This uses a DQL-based matcher

> **[Log metrics](https://docs.dynatrace.com/docs/analyze-explore-automate/logs/lma-log-processing/lma-log-metrics)**
>
> Create metrics based on log data and use them throughout Dynatrace like any other metric.

2. Create alerting using Metric events&nbsp;[Metric events — Dynatrace Docs](https://docs.dynatrace.com/docs/dynatrace-intelligence/anomaly-detection/metric-events)  
3. Send to Teams using webhook.

On the other hand, ifyour goal is simply “run a DQL query and post the result to Teams”, you can do it directly with Workflows.&nbsp;Use Workflows action: Execute DQL Query to run your query and get results for subsequent steps

> **[DQL query action for Workflows](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/default-workflow-actions/dql-query-workflow-action)**
>
> Use the \*\*Execute DQL Query\*\* action in Dynatrace Workflows to run DQL queries against Grail and pass the results to subsequent tasks.

and add Microsoft Teams Connector → Send message and format the message&nbsp;[Microsoft Teams Connector — Dynatrace Docs](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/actions/microsoft-teams)
