<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Missing Management Zone in Davis event trigger in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/267060#M1984</link>
    <description>&lt;P&gt;//i Christian thanks for your reply maybe below code can help someone else&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Based on effected entities, and returning ManagementZone if found in any&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;import { monitoredEntitiesClient } from "@dynatrace-sdk/client-classic-environment-v2";&lt;BR /&gt;import { execution } from '@dynatrace-sdk/automation-utils';&lt;/P&gt;&lt;P&gt;export default async function ({ execution_id }) {&lt;BR /&gt;const filterMZ = "***Fill in MZ name to filter***";&lt;BR /&gt;const ex = await execution(execution_id);&lt;BR /&gt;const eventData = ex.event();&lt;BR /&gt;console.log(eventData);&lt;BR /&gt;// Extracting entities from event&lt;BR /&gt;for (const My_entity of eventData.affected_entity_ids) {&lt;BR /&gt;console.log(`Processing element: ${My_entity}`);&lt;BR /&gt;try {&lt;BR /&gt;// Retrieve entity data from Dynatrace&lt;BR /&gt;let entityData = await monitoredEntitiesClient.getEntity({&lt;BR /&gt;entityId: My_entity&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Check if any management zone has the specific name&lt;BR /&gt;for (const zone of entityData.managementZones) {&lt;BR /&gt;console.log(zone.name);&lt;BR /&gt;if (zone.name === filterMZ) {&lt;BR /&gt;return filterMZ;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;} catch (error) {&lt;BR /&gt;console.error(`Failed to retrieve data for element: ${My_entity}`, error);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return "";&lt;BR /&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 10 Jan 2025 09:00:06 GMT</pubDate>
    <dc:creator>henk_stobbe</dc:creator>
    <dc:date>2025-01-10T09:00:06Z</dc:date>
    <item>
      <title>Missing Management Zone in Davis event trigger</title>
      <link>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/266871#M1981</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="henk_stobbe_0-1736338071325.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/25611i30224438057D8AB9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="henk_stobbe_0-1736338071325.png" alt="henk_stobbe_0-1736338071325.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello, am I missing a MZ selection or is there a TAG I can use instead. Could also be that this is all and the rest is up to the workflow?&lt;/P&gt;&lt;P&gt;KR Henk&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 12:09:44 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/266871#M1981</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2025-01-08T12:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Missing Management Zone in Davis event trigger</title>
      <link>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/267053#M1983</link>
      <description>&lt;P&gt;Unfortunately, Management Zone Filtering is not available for (Davis) Event Triggers in Workflows.&lt;/P&gt;&lt;P&gt;If you already know that you're looking for a specific tag, that would be an option.&lt;/P&gt;&lt;P&gt;If not, filtering should be doable in a follow-up task within the same Workflow with a DQL task (or maybe using "Run JavaScript"). Please have a look at &lt;A href="https://community.dynatrace.com/t5/Dashboarding/Filter-by-Management-Zone-using-DQL/m-p/232272/highlight/true#M3548" target="_blank"&gt;https://community.dynatrace.com/t5/Dashboarding/Filter-by-Management-Zone-using-DQL/m-p/232272/highlight/true#M3548&lt;/A&gt; for inspiration.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 07:12:16 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/267053#M1983</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2025-01-10T07:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Missing Management Zone in Davis event trigger</title>
      <link>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/267060#M1984</link>
      <description>&lt;P&gt;//i Christian thanks for your reply maybe below code can help someone else&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Based on effected entities, and returning ManagementZone if found in any&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;import { monitoredEntitiesClient } from "@dynatrace-sdk/client-classic-environment-v2";&lt;BR /&gt;import { execution } from '@dynatrace-sdk/automation-utils';&lt;/P&gt;&lt;P&gt;export default async function ({ execution_id }) {&lt;BR /&gt;const filterMZ = "***Fill in MZ name to filter***";&lt;BR /&gt;const ex = await execution(execution_id);&lt;BR /&gt;const eventData = ex.event();&lt;BR /&gt;console.log(eventData);&lt;BR /&gt;// Extracting entities from event&lt;BR /&gt;for (const My_entity of eventData.affected_entity_ids) {&lt;BR /&gt;console.log(`Processing element: ${My_entity}`);&lt;BR /&gt;try {&lt;BR /&gt;// Retrieve entity data from Dynatrace&lt;BR /&gt;let entityData = await monitoredEntitiesClient.getEntity({&lt;BR /&gt;entityId: My_entity&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Check if any management zone has the specific name&lt;BR /&gt;for (const zone of entityData.managementZones) {&lt;BR /&gt;console.log(zone.name);&lt;BR /&gt;if (zone.name === filterMZ) {&lt;BR /&gt;return filterMZ;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;} catch (error) {&lt;BR /&gt;console.error(`Failed to retrieve data for element: ${My_entity}`, error);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return "";&lt;BR /&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 Jan 2025 09:00:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Missing-Management-Zone-in-Davis-event-trigger/m-p/267060#M1984</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2025-01-10T09:00:06Z</dc:date>
    </item>
  </channel>
</rss>

