# Assistance Required for Formatting DQL Query Results in Email

**URL:** <https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112>\
**Category:** DQL\
**Tags:** dql, workflows, problems\
**Created:** [June 16, 2025, 10:49am UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112 "2025-06-16T10:49:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aninda](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@aninda](https://community.dynatrace.com/u/aninda)\
**Post date:** [June 16, 2025, 10:49am UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/1 "2025-06-16T10:49:38Z")

</div>

Hello Team,

I am currently working on sending the results of a DQL query via email. For this purpose, I have created the following workflow:

 ![aninda_2-1750070833511.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/4/84cb214ad5ace310b7dc3b1d0265c27392ee1ed3.png)

The workflow is functioning as expected, and the emails are being received. However, the data in the email is not formatted properly. Below is a snapshot of the data that is being received:

 ![aninda_3-1750070857676.png](https://global.discourse-cdn.com/dynatrace/original/1X/c75ee113ccf0ee4dee6db807ec92e317e50ec3dd.png)

I would like to know if there is a way to present this data in a tabular format. The DQL query being used is as follows:

fetch logs  
| filter matchesPhrase(index, “\<index name\>”)  
| filter matchesPhrase(content,“- ERROR -”)  
| filter contains(source,“\<keyword\>”)  
| fieldsAdd container\_name = splitString(source,“/”)[-2]  
| fieldsAdd interface\_name\_temp = splitString(source, “/”)[-1]  
| fieldsAdd interface\_name = splitString(interface\_name\_temp,“.”)[0]  
| fieldsAdd event\_date = formatTimestamp(timestamp, format:“dd-MM-yyyy”)  
| fields event\_date, container\_name, interface\_name, source, content

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 16, 2025, 11:38am UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/2 "2025-06-16T11:38:29Z")

</div>

Can you provide a screen shot of what you have defined out in the email segment of the workflow?

---

<div class="post-metadata">

**Author:** ![aninda](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@aninda](https://community.dynatrace.com/u/aninda)\
**Post date:** [June 16, 2025, 11:40am UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/3 "2025-06-16T11:40:16Z")

</div>

Hi Chad,

I have defined the below in the email segment:

 ![aninda_0-1750073988568.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/6/56b70858456c1a16cc9eae79b10ebc132e4b6ec4.png)

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 16, 2025, 11:50am UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/4 "2025-06-16T11:50:28Z")

</div>

I would recommend using a similar format as how custom events for alerting works where you leverage Placeholders to provide dynamic variable data like " Host {Host.Name} reported high CPU with a value above {Baseline}. "

Granted that is not the value you will use, but it showcases the mind set of using dynamic variables you set within your grail query. Much like you did for {Record}. You can also use the right hand tab to test the result to verify the data is properly formatted without spamming emails.

---

<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:** [June 16, 2025, 5:41pm UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/5 "2025-06-16T17:41:20Z")

</div>

Hi there. One limitation you will need to keep in mind is that sending email with Workflows currently only supports plain text, as mentioned in the [documentation](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/actions/email#send-an-email-with-workflows). You will need to format the body of your email accordingly so that it generates a legible message body within the constraints of plain text. That formatting would likely live inside the loop (between lines #1 and #3) and involve a mix of actual text and specific values from your results.

---

<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:** [July 9, 2025, 9:25pm UTC](https://community.dynatrace.com/t/assistance-required-for-formatting-dql-query-results-in-email/52112/6 "2025-07-09T21:25:28Z")

</div>

Updating this thread with [availability](https://docs.dynatrace.com/docs/whats-new/saas/sprint-318#email) of email formatting as of SaaS release 1.318.
