<?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 How do I get the previous result from a Javascript task in Workflows? in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/How-do-I-get-the-previous-result-from-a-Javascript-task-in/m-p/295487#M2522</link>
    <description>&lt;P&gt;Hi, I have some Javascript code which gets the current date and formats it into two-digit segments.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example: 260301&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function () {
  const now = new Date();

  // Extract parts
  const year = String(now.getFullYear()).slice(-2); // last 2 digits
  const month = String(now.getMonth() + 1).padStart(2, "0"); // months are 0‑indexed
  const day = String(now.getDate()).padStart(2, "0");

  const formatted = `${year}${month}${day}`;

  console.log(formatted);  // e.g., "260302"
  return formatted;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I am trying to use it in the next task that I have. However, it always turns up blank with just the squiggly brackets only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the documentation, it said to use something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{{ result('date') }}&lt;/LI-CODE&gt;&lt;P&gt;where 'date' is the name of the previous task/function. Any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2026 12:54:15 GMT</pubDate>
    <dc:creator>badgerfifteen</dc:creator>
    <dc:date>2026-03-02T12:54:15Z</dc:date>
    <item>
      <title>How do I get the previous result from a Javascript task in Workflows?</title>
      <link>https://community.dynatrace.com/t5/Automations/How-do-I-get-the-previous-result-from-a-Javascript-task-in/m-p/295487#M2522</link>
      <description>&lt;P&gt;Hi, I have some Javascript code which gets the current date and formats it into two-digit segments.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example: 260301&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function () {
  const now = new Date();

  // Extract parts
  const year = String(now.getFullYear()).slice(-2); // last 2 digits
  const month = String(now.getMonth() + 1).padStart(2, "0"); // months are 0‑indexed
  const day = String(now.getDate()).padStart(2, "0");

  const formatted = `${year}${month}${day}`;

  console.log(formatted);  // e.g., "260302"
  return formatted;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I am trying to use it in the next task that I have. However, it always turns up blank with just the squiggly brackets only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the documentation, it said to use something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{{ result('date') }}&lt;/LI-CODE&gt;&lt;P&gt;where 'date' is the name of the previous task/function. Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2026 12:54:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/How-do-I-get-the-previous-result-from-a-Javascript-task-in/m-p/295487#M2522</guid>
      <dc:creator>badgerfifteen</dc:creator>
      <dc:date>2026-03-02T12:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the previous result from a Javascript task in Workflows?</title>
      <link>https://community.dynatrace.com/t5/Automations/How-do-I-get-the-previous-result-from-a-Javascript-task-in/m-p/295494#M2523</link>
      <description>&lt;P&gt;I think I sorted it. It seems I have to create a duplicate task in the workflow for the result to be registered as a selectable option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2026 14:44:16 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/How-do-I-get-the-previous-result-from-a-Javascript-task-in/m-p/295494#M2523</guid>
      <dc:creator>badgerfifteen</dc:creator>
      <dc:date>2026-03-02T14:44:16Z</dc:date>
    </item>
  </channel>
</rss>

