<?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: Workflow using process.exit in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269625#M2033</link>
    <description>&lt;P&gt;As far as I know, process.exit() is not supported by our runtime.&lt;/P&gt;&lt;P&gt;I would recommend doing this via Run JavaScript and "return":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export default async function ({ executionId }) {
  let x = 1;
 
  while (x &amp;gt; 0) {
    console.log(x);
    x++;
   
    if (x &amp;gt; 10) {
      console.log('Exiting...');
      return;  
    }
  }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="christian_kreuz_0-1739196133012.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26291i63AD78F9604BC2BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="christian_kreuz_0-1739196133012.png" alt="christian_kreuz_0-1739196133012.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 14:02:40 GMT</pubDate>
    <dc:creator>christian_kreuz</dc:creator>
    <dc:date>2025-02-10T14:02:40Z</dc:date>
    <item>
      <title>Workflow using process.exit</title>
      <link>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269585#M2032</link>
      <description>&lt;DIV class=""&gt;&lt;FONT color="#000000"&gt;Good morning,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT color="#000000"&gt;My (workflow) script fetches data in a loop, and when a certain condition is met, the script needs to stop completely. I want to use process.exit for this. Is this a problem?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;As an more clear example see below:&lt;/DIV&gt;&lt;DIV class=""&gt;let x = 1;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;while (x &amp;gt; 0) {&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(x);&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x++;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (x &amp;gt; 10) {&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log('Exiting...');&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;process.exit();&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV class=""&gt;}&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT color="#000000"&gt;Any problems in this?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT color="#000000"&gt;KR Henk&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Feb 2025 09:01:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269585#M2032</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2025-02-10T09:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow using process.exit</title>
      <link>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269625#M2033</link>
      <description>&lt;P&gt;As far as I know, process.exit() is not supported by our runtime.&lt;/P&gt;&lt;P&gt;I would recommend doing this via Run JavaScript and "return":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export default async function ({ executionId }) {
  let x = 1;
 
  while (x &amp;gt; 0) {
    console.log(x);
    x++;
   
    if (x &amp;gt; 10) {
      console.log('Exiting...');
      return;  
    }
  }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="christian_kreuz_0-1739196133012.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26291i63AD78F9604BC2BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="christian_kreuz_0-1739196133012.png" alt="christian_kreuz_0-1739196133012.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 14:02:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269625#M2033</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2025-02-10T14:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow using process.exit</title>
      <link>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269626#M2034</link>
      <description>&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;Clear, so if you are in a subroutine&amp;nbsp; you can only do a return out of that routine to prevent spaghetti (-;&lt;/P&gt;&lt;P&gt;KR Henk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 14:28:04 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Workflow-using-process-exit/m-p/269626#M2034</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2025-02-10T14:28:04Z</dc:date>
    </item>
  </channel>
</rss>

