<?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 How to trigger a notification using gs.eventQueueScheduled based on a RITM state change in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019568#M613</link>
    <description>&lt;P&gt;&lt;SPAN&gt;It is required that when a rhythm is changed to the “waiting” state and 5 business days pass and the status is not updated, the system automatically changes the rhythm to the closed or completed state.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;// Business Rule: Trigger Auto-Close on "On Hold" (-5) after 10 minutes&lt;BR /&gt;(function executeRule(current, previous /*null when async*/) {&lt;BR /&gt;if (current.state == '-5' &amp;amp;&amp;amp; previous.state != '-5') {&lt;BR /&gt;var tenMinutesLater = new GlideDateTime();&lt;BR /&gt;tenMinutesLater.addseconds(10);&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Programar el evento que cerrará automáticamente el requerimiento&lt;BR /&gt;gs.eventQueueScheduled('close_on_hold_request', current, '', '', tenMinutesLater);&lt;BR /&gt;}&lt;BR /&gt;})(current, previous);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. create event&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prueba_0-1723772997002.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/379635i84F784735C647DFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prueba_0-1723772997002.png" alt="Prueba_0-1723772997002.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3 create script action&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Script Action: Close request after 1 minute&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; process(event) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Obtén el GlideRecord del evento&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecord&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sc_req_item'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (gr.&lt;/SPAN&gt;&lt;SPAN&gt;get&lt;/SPAN&gt;&lt;SPAN&gt;(event.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_id'&lt;/SPAN&gt;&lt;SPAN&gt;))) { &lt;/SPAN&gt;&lt;SPAN&gt;// Asegúrate de que el registro existe&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (gr.state == &lt;/SPAN&gt;&lt;SPAN&gt;'-5'&lt;/SPAN&gt;&lt;SPAN&gt;) { &lt;/SPAN&gt;&lt;SPAN&gt;// Verifica que el estado sea "En espera" (-5)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gr.state = &lt;/SPAN&gt;&lt;SPAN&gt;'3'&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// Cambia el estado a "Cerrado" (valor 3 para "Closed", ajusta si es necesario)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gr.update();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;})(event);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prueba_1-1723773063050.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/379636i6330F4E697F94DF5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prueba_1-1723773063050.png" alt="Prueba_1-1723773063050.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I don't know what I'm doing wrong but it doesn't work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2024 01:59:09 GMT</pubDate>
    <dc:creator>Prueba</dc:creator>
    <dc:date>2024-08-16T01:59:09Z</dc:date>
    <item>
      <title>How to trigger a notification using gs.eventQueueScheduled based on a RITM state change</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019568#M613</link>
      <description>&lt;P&gt;&lt;SPAN&gt;It is required that when a rhythm is changed to the “waiting” state and 5 business days pass and the status is not updated, the system automatically changes the rhythm to the closed or completed state.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;// Business Rule: Trigger Auto-Close on "On Hold" (-5) after 10 minutes&lt;BR /&gt;(function executeRule(current, previous /*null when async*/) {&lt;BR /&gt;if (current.state == '-5' &amp;amp;&amp;amp; previous.state != '-5') {&lt;BR /&gt;var tenMinutesLater = new GlideDateTime();&lt;BR /&gt;tenMinutesLater.addseconds(10);&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Programar el evento que cerrará automáticamente el requerimiento&lt;BR /&gt;gs.eventQueueScheduled('close_on_hold_request', current, '', '', tenMinutesLater);&lt;BR /&gt;}&lt;BR /&gt;})(current, previous);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. create event&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prueba_0-1723772997002.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/379635i84F784735C647DFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prueba_0-1723772997002.png" alt="Prueba_0-1723772997002.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3 create script action&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Script Action: Close request after 1 minute&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; process(event) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Obtén el GlideRecord del evento&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecord&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sc_req_item'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (gr.&lt;/SPAN&gt;&lt;SPAN&gt;get&lt;/SPAN&gt;&lt;SPAN&gt;(event.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_id'&lt;/SPAN&gt;&lt;SPAN&gt;))) { &lt;/SPAN&gt;&lt;SPAN&gt;// Asegúrate de que el registro existe&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (gr.state == &lt;/SPAN&gt;&lt;SPAN&gt;'-5'&lt;/SPAN&gt;&lt;SPAN&gt;) { &lt;/SPAN&gt;&lt;SPAN&gt;// Verifica que el estado sea "En espera" (-5)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gr.state = &lt;/SPAN&gt;&lt;SPAN&gt;'3'&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// Cambia el estado a "Cerrado" (valor 3 para "Closed", ajusta si es necesario)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gr.update();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;})(event);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prueba_1-1723773063050.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/379636i6330F4E697F94DF5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prueba_1-1723773063050.png" alt="Prueba_1-1723773063050.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I don't know what I'm doing wrong but it doesn't work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 01:59:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019568#M613</guid>
      <dc:creator>Prueba</dc:creator>
      <dc:date>2024-08-16T01:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger a notification using gs.eventQueueScheduled based on a RITM state change</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019575#M614</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;It's 5 days but I'm doing it with 10 seconds to do the test.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;and the business rule is executed after the status changes to "on hold"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 02:27:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019575#M614</guid>
      <dc:creator>Prueba</dc:creator>
      <dc:date>2024-08-16T02:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger a notification using gs.eventQueueScheduled based on a RITM state change</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019578#M615</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;It is important to say that it does execute the event and what is failing is the action script&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prueba_0-1723775607300.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/379638i3C053C3124BC84D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prueba_0-1723775607300.png" alt="Prueba_0-1723775607300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 02:33:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019578#M615</guid>
      <dc:creator>Prueba</dc:creator>
      <dc:date>2024-08-16T02:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger a notification using gs.eventQueueScheduled based on a RITM state change</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019597#M616</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/405284"&gt;@Prueba&lt;/a&gt;, I tried your problem in my PDI, please make changes in Business Rule&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add event like below line&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;gs.eventQueue('close_on_hold_request',current,current.number,tenMinutesLater);&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;You are passing an extra parameter here.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Please mark my answer correct and helpful if this works for you&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks and Regards&lt;/DIV&gt;&lt;DIV&gt;Sarthak&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 04:35:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3019597#M616</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2024-08-16T04:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger a notification using gs.eventQueueScheduled based on a RITM state change</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3020108#M622</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Hello &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/19502"&gt;@Sarthak&lt;/a&gt; I made the change in the business rule but it does not make the change and "gs.eventQueueScheduled" must be used so that it is scheduled and executed 10 seconds later&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 13:43:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-trigger-a-notification-using-gs-eventqueuescheduled-based/m-p/3020108#M622</guid>
      <dc:creator>Prueba</dc:creator>
      <dc:date>2024-08-16T13:43:27Z</dc:date>
    </item>
  </channel>
</rss>

