<?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>question Implement timeout in Run Server Side Script in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588523#M160302</link>
    <description>&lt;P&gt;Is it possible to write a script in "Run Server Side Script" that will execute a timeout for 590 seconds?&lt;BR /&gt;Like this timeout in the picture.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36050i456F6F9CE9474212/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 05:39:12 GMT</pubDate>
    <dc:creator>ayano</dc:creator>
    <dc:date>2021-03-04T05:39:12Z</dc:date>
    <item>
      <title>Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588523#M160302</link>
      <description>&lt;P&gt;Is it possible to write a script in "Run Server Side Script" that will execute a timeout for 590 seconds?&lt;BR /&gt;Like this timeout in the picture.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36050i456F6F9CE9474212/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 05:39:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588523#M160302</guid>
      <dc:creator>ayano</dc:creator>
      <dc:date>2021-03-04T05:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588524#M160303</link>
      <description>&lt;P&gt;On server scripts you can use the global gs.sleep method to pause the script in milliseconds&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;gs.sleep(590000); //590 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 11:31:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588524#M160303</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2021-03-04T11:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588525#M160304</link>
      <description>&lt;P&gt;Just as a warning on this - it can be dangerous if that script will run concurrently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;gs.sleep will keep control of the thread, and on smaller instances (example with only two app nodes) you can quickly run out of threads and cause an instance outage.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 12:16:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588525#M160304</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2021-03-04T12:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588526#M160305</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="adbf88b0db33c894190dfb24399619c2"&gt;@ayano&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use this in the run server side script step to pause for the seconds&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function executeStep(inputs, outputs, stepResult, timeout) {

        var secondsValue = 590;
	var seconds = parseInt(secondsValue, 10) * 1000;
	var start = parseInt(new Date().getTime()) + seconds;
	while(start&amp;gt;parseInt(new Date().getTime())){
		// do nothing
	}
	stepResult.setOutputMessage('This step gave sleep of 590 seconds');
	stepResult.setSuccess();

}(inputs, outputs, stepResult, timeout));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 12:25:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588526#M160305</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2021-03-04T12:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588527#M160306</link>
      <description>&lt;P&gt;Hi Ankur san,&lt;/P&gt;
&lt;P&gt;Thank you for the information.&lt;/P&gt;
&lt;P&gt;Did you succeed with this script?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 22:27:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588527#M160306</guid>
      <dc:creator>ayano</dc:creator>
      <dc:date>2021-03-09T22:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588528#M160307</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="adbf88b0db33c894190dfb24399619c2"&gt;@ayano&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not tested this recently.&lt;/P&gt;
&lt;P&gt;But when I used something similar few months back it did work&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 05:32:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/588528#M160307</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2021-03-10T05:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Implement timeout in Run Server Side Script</title>
      <link>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/3005153#M525361</link>
      <description>&lt;P&gt;This script pauses the entire instance. I pasted it in my widget server script and everybody on the team can't code anything in the instance for 10 minutes lol&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 15:19:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/implement-timeout-in-run-server-side-script/m-p/3005153#M525361</guid>
      <dc:creator>GustavoTardinn</dc:creator>
      <dc:date>2024-07-31T15:19:14Z</dc:date>
    </item>
  </channel>
</rss>

