<?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 Re: How do you write script to add Approvers under a catalog task? in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110591#M1687</link>
    <description>&lt;P&gt;Thank you so much for your response,&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/230435"&gt;@AshishKM&lt;/a&gt;&amp;nbsp;!&lt;BR /&gt;&lt;BR /&gt;Does this mean that it is not recommended to add "Approvers" to a Catalog Task that is not associated with an RITM? If that's the case, could you clarify why the option to add "Approvers" exists for these tasks?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Currently, we have a flow where Catalog Tasks are created without being linked to an RITM. I am working on writing a script to add "Approvers", but I've been running into some challenges.&lt;BR /&gt;&lt;BR /&gt;I appreciate your insight!&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2024 00:45:59 GMT</pubDate>
    <dc:creator>schoi</dc:creator>
    <dc:date>2024-11-22T00:45:59Z</dc:date>
    <item>
      <title>How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110512#M1683</link>
      <description>&lt;P&gt;Hi team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On submit, I want to modify the script to add 'Approvers' when automatically creating a Catalog Task. I currently have this code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; app = &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;'sysapproval_approver'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.initialize();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.approver = &lt;/SPAN&gt;&lt;SPAN&gt;'[sys_id]'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.insert();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but it doesn't add any approvers.&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt; &lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-11-21 153237.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/403412iED5F955D7322E1BF/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-11-21 153237.png" alt="Screenshot 2024-11-21 153237.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Would any of you know how to modify the script to add "Approvers"?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Nov 2024 23:37:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110512#M1683</guid>
      <dc:creator>schoi</dc:creator>
      <dc:date>2024-11-21T23:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110515#M1684</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/805189"&gt;@schoi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The approvals applied on RITM and configured in workflow/or/flow.&lt;/P&gt;
&lt;P&gt;If you are trying to add more approval, add them at RITM level.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Thanks,&lt;/P&gt;
&lt;P&gt;AshishKm&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 23:52:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110515#M1684</guid>
      <dc:creator>AshishKM</dc:creator>
      <dc:date>2024-11-21T23:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110517#M1685</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/805189"&gt;@schoi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Please note that the approvals for a catalog items are either on the Request level or RITM level. In both cases, your approvals are automatically added to the related list "approvals" under your Request and RITM form.&lt;BR /&gt;&lt;BR /&gt;If you want to add approvals for catalog item submission, consider reviewing the workflow and add approvals there.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 23:58:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110517#M1685</guid>
      <dc:creator>vMalhotra</dc:creator>
      <dc:date>2024-11-21T23:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110591#M1687</link>
      <description>&lt;P&gt;Thank you so much for your response,&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/230435"&gt;@AshishKM&lt;/a&gt;&amp;nbsp;!&lt;BR /&gt;&lt;BR /&gt;Does this mean that it is not recommended to add "Approvers" to a Catalog Task that is not associated with an RITM? If that's the case, could you clarify why the option to add "Approvers" exists for these tasks?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Currently, we have a flow where Catalog Tasks are created without being linked to an RITM. I am working on writing a script to add "Approvers", but I've been running into some challenges.&lt;BR /&gt;&lt;BR /&gt;I appreciate your insight!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 00:45:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110591#M1687</guid>
      <dc:creator>schoi</dc:creator>
      <dc:date>2024-11-22T00:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110592#M1688</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you so much for your response,&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/494703"&gt;@vMalhotra&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;! Following up with the same question above-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this mean that it is not recommended to add "Approvers" to a Catalog Task that is not associated with an RITM? If that's the case, could you clarify why the option to add "Approvers" exists for these tasks?&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, we have a flow where Catalog Tasks are created without being linked to an RITM. I am working on writing a script to add "Approvers", but I've been running into some challenges.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I appreciate your insight!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 00:46:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110592#M1688</guid>
      <dc:creator>schoi</dc:creator>
      <dc:date>2024-11-22T00:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110611#M1689</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/805189"&gt;@schoi&lt;/a&gt;&amp;nbsp;, are you not using catalog item from sc_cat_item table, how come SCTASK are generated without REQ=&amp;gt;RITM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;seems like , flow is creating direct record in sc_task ... so this will consider as record producer on catalog task table directly. if that is the case , you can add approval in flow.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 04:34:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3110611#M1689</guid>
      <dc:creator>AshishKM</dc:creator>
      <dc:date>2024-11-22T04:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3112529#M1704</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/230435"&gt;@AshishKM&lt;/a&gt;, got it! Since sc_task could have approvers, how could I add approvers by modifying a script? As mentioned above, this script is not working:&lt;BR /&gt;&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;app =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;GlideRecord&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sysapproval_approver'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.initialize();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.approver =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'[sys_id]'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; app.insert();'&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Nov 2024 15:46:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3112529#M1704</guid>
      <dc:creator>schoi</dc:creator>
      <dc:date>2024-11-25T15:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3112569#M1705</link>
      <description>&lt;P&gt;You can create approvals via script, but in this case you also want to link the approval to the sc_task record so that it shows on the Related List.&amp;nbsp; Your current script may be creating orphaned approval records, or there could be a Business Rule or Data Policy in place to prevent the insert if not all of the required fields are populated. Here the fields that I have populated when creating approval records via script.&amp;nbsp; I've only ever created approvals at the RITM level - when approval is required before the flow/workflow continues to scripts/Catalog task, etc. but the script should work the same at the Catalog Task level...&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;var app = new GlideRecord('sysapproval_approver');
app.newRecord(); //newer method than initialize(), but either still works
app.approver = '[sys_id of user]';
app.sysapproval = '[sys_id of sc_task record]';
app.source_table = 'sc_task';
app.document_id = '[sys_id of sc_task record]';
app.state = 'requested';
app.insert();&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 16:28:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3112569#M1705</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-11-25T16:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113605#M1711</link>
      <description>&lt;P&gt;Thank you Brad for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 15:52:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113605#M1711</guid>
      <dc:creator>schoi</dc:creator>
      <dc:date>2024-11-26T15:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113620#M1712</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/805189"&gt;@schoi&lt;/a&gt;&amp;nbsp;- just checking if the code shared by other, working for you or not.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 16:08:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113620#M1712</guid>
      <dc:creator>AshishKM</dc:creator>
      <dc:date>2024-11-26T16:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you write script to add Approvers under a catalog task?</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113703#M1713</link>
      <description>&lt;P&gt;You are welcome!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 17:31:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-do-you-write-script-to-add-approvers-under-a-catalog-task/m-p/3113703#M1713</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-11-26T17:31:30Z</dc:date>
    </item>
  </channel>
</rss>

