<?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: Referencing variables outside of the default function now fails in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/243666#M859</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/66979"&gt;@Dynosaure&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the&amp;nbsp;&lt;SPAN&gt;$dt_timeframe_from and&amp;nbsp;$dt_timeframe_to variables are still used within the&amp;nbsp;export default async function, I wouldn't say it's the same issue/root cause as I described above. And the solution I provided will not solve it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That's why I believe your situation deserves a whole new thread in the community as it will require a different explanation/solution from Dynatrace R&amp;amp;D teams.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope that helps (a tiny bit).&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2024 08:27:49 GMT</pubDate>
    <dc:creator>thomas_c</dc:creator>
    <dc:date>2024-04-23T08:27:49Z</dc:date>
    <item>
      <title>Referencing variables outside of the default function now fails</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242681#M853</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I just noticed new errors when loading certain code tiles in my dashboard:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "error": {
    "code": 540,
    "message": "Execution crashed.",
    "details": {
      "logs": "",
      "type": "UNCAUGHT_EXCEPTION",
      "message": "Uncaught (in promise) ReferenceError: $Scope is not defined",
      "details": {
        "sourceLine": "  if($Scope[0] === \"Tenant\") {",
        "lineNumber": 409,
        "startColumn": 3,
        "stack": "ReferenceError: $Scope is not defined\n    at webApps (file:///script.ts:409:3)\n    at getWeightedScore (file:///script.ts:30:23)\n    at default (file:///script.ts:1010:33)"
      }
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code didn't change and was working for the past year.&lt;/P&gt;&lt;P&gt;I notice that references to the variable "Scope" only fail when located in functions other than the&amp;nbsp;&lt;STRONG&gt;export default async function().&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I didn't notice any change in the &lt;A href="https://docs.dynatrace.com/docs/observe-and-explore/dashboards-and-notebooks/dashboards-new/components/dashboard-component-variable#use-with-an-explore-tile" target="_self"&gt;public documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Could you help me fix that error please?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 19:00:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242681#M853</guid>
      <dc:creator>thomas_c</dc:creator>
      <dc:date>2024-04-15T19:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing variables outside of the default function now fails</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242690#M854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/7815"&gt;@thomas_c&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please create a support ticket via&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://one.dynatrace.com/hc/en-us/requests" target="_blank" rel="noopener noreferrer"&gt;https://one.dynatrace.com/hc/en-us/requests&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;. Tech support will help you with this issue.&amp;nbsp;Please attach the snipped code or the link to the snippet to the ticket.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;BR /&gt;Sini&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 07:01:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242690#M854</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2024-04-16T07:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing variables outside of the default function now fails</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242794#M855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I discovered that $variable objects cannot be referenced outside of &lt;SPAN&gt;the&amp;nbsp;&lt;/SPAN&gt;export default async function() anymore. So, the issue is fixed by passing such object as argument of other functions.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 15:50:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/242794#M855</guid>
      <dc:creator>thomas_c</dc:creator>
      <dc:date>2024-04-16T15:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing variables outside of the default function now fails</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/243658#M858</link>
      <description>&lt;P&gt;Good morning,&lt;BR /&gt;We also encounter the same problem following the last update. Is there a solution. it no longer recognizes the time zone. Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import { problemsClient } from "@dynatrace-sdk/client-classic-environment-v2";&lt;/P&gt;&lt;P&gt;export default async function fetchMetricResults() {&lt;BR /&gt;let probS = "";&lt;BR /&gt;if($OS == "WINDOWS") probS += "entityTags(\"OS:Windows\"),";&lt;BR /&gt;else if ($OS == "LINUX") probS += "entityTags(\"OS:Linux\"),";&lt;BR /&gt;if($ManagementZone != "ALL") probS += "managementZones(" + $ManagementZone.toString() + "),";&lt;BR /&gt;&lt;BR /&gt;probS += "status(\"open\")";&lt;BR /&gt;&lt;BR /&gt;const total = await problemsClient.getProblems({&lt;BR /&gt;from: Date.parse($dt_timeframe_from).toString(),&lt;BR /&gt;to: Date.parse($dt_timeframe_to).toString(),&lt;BR /&gt;problemSelector: probS,&lt;BR /&gt;pageSize: 1&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;const critical = await problemsClient.getProblems({&lt;BR /&gt;from: Date.parse($dt_timeframe_from).toString(),&lt;BR /&gt;to: Date.parse($dt_timeframe_to).toString(),&lt;BR /&gt;problemSelector: "text(\"CRITICAL\")," + probS,&lt;BR /&gt;pageSize: 1&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;const warning = await problemsClient.getProblems({&lt;BR /&gt;from: Date.parse($dt_timeframe_from).toString(),&lt;BR /&gt;to: Date.parse($dt_timeframe_to).toString(),&lt;BR /&gt;problemSelector: "text(\"WARNING\")," + probS,&lt;BR /&gt;pageSize: 1&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;return " &lt;span class="lia-unicode-emoji" title=":red_circle:"&gt;🔴&lt;/span&gt; " + total.totalCount&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 08:09:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/243658#M858</guid>
      <dc:creator>Dynosaure</dc:creator>
      <dc:date>2024-04-23T08:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing variables outside of the default function now fails</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/243666#M859</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/66979"&gt;@Dynosaure&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the&amp;nbsp;&lt;SPAN&gt;$dt_timeframe_from and&amp;nbsp;$dt_timeframe_to variables are still used within the&amp;nbsp;export default async function, I wouldn't say it's the same issue/root cause as I described above. And the solution I provided will not solve it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That's why I believe your situation deserves a whole new thread in the community as it will require a different explanation/solution from Dynatrace R&amp;amp;D teams.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope that helps (a tiny bit).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 08:27:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Referencing-variables-outside-of-the-default-function-now-fails/m-p/243666#M859</guid>
      <dc:creator>thomas_c</dc:creator>
      <dc:date>2024-04-23T08:27:49Z</dc:date>
    </item>
  </channel>
</rss>

