<?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 Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920391#M1111171</link>
    <description>&lt;P&gt;Good day everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently am using a UI Action to convert a RITM to a CHG. Within this UI Action, I have a few data fields that get copied over to the CHG ticket, of those variables is the Watch List.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a sample of my current script that I am currently copying over fields from RITM &amp;gt; CHG and a few of them are just OOTB. I've tried to copy over the "watch_list" field that is on the RITM to no avail. The one highlighted in blue, I tried creating a variable on the form that gathers the watch list and tried to copy that to the CHG (similar to others). I know I am missing something and would like your second/third set of eyes to understand where I am going wrong.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;var changeRequest = ChangeRequest.newNormal();&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("short_description", current.variables.short_description);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("cmdb_ci", current.variables.cmdb_ci);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("u_client", current.variables.client);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("u_environment", current.variables.environment);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (changeRequest.hasValidChoice('priority', current.priority))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; changeRequest.setValue("priority", current.priority);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("sys_domain", current.sys_domain);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("company", current.company);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("risk_impact_analysis", current.variables.risk_and_impact_analysis);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("justification", current.variables.justification);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("start_date", current.variables.planned_start_date_ci);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("requested_by", current.request.requested_for);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue(&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;EM&gt;"watch_list", current.variables.watchlist);&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("parent", current.sys_id);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;Thank you all and appreciate your feedback.&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 06 May 2024 21:17:49 GMT</pubDate>
    <dc:creator>Joel O</dc:creator>
    <dc:date>2024-05-06T21:17:49Z</dc:date>
    <item>
      <title>Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list</title>
      <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920391#M1111171</link>
      <description>&lt;P&gt;Good day everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently am using a UI Action to convert a RITM to a CHG. Within this UI Action, I have a few data fields that get copied over to the CHG ticket, of those variables is the Watch List.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a sample of my current script that I am currently copying over fields from RITM &amp;gt; CHG and a few of them are just OOTB. I've tried to copy over the "watch_list" field that is on the RITM to no avail. The one highlighted in blue, I tried creating a variable on the form that gathers the watch list and tried to copy that to the CHG (similar to others). I know I am missing something and would like your second/third set of eyes to understand where I am going wrong.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;var changeRequest = ChangeRequest.newNormal();&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("short_description", current.variables.short_description);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("cmdb_ci", current.variables.cmdb_ci);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("u_client", current.variables.client);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("u_environment", current.variables.environment);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (changeRequest.hasValidChoice('priority', current.priority))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; changeRequest.setValue("priority", current.priority);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("sys_domain", current.sys_domain);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("company", current.company);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("risk_impact_analysis", current.variables.risk_and_impact_analysis);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("justification", current.variables.justification);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("start_date", current.variables.planned_start_date_ci);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("requested_by", current.request.requested_for);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue(&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;EM&gt;"watch_list", current.variables.watchlist);&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; changeRequest.setValue("parent", current.sys_id);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;Thank you all and appreciate your feedback.&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 May 2024 21:17:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920391#M1111171</guid>
      <dc:creator>Joel O</dc:creator>
      <dc:date>2024-05-06T21:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list</title>
      <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920417#M1111175</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/28231"&gt;@Joel O&lt;/a&gt;&amp;nbsp;Try the below script.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var changeRequest = new ChangeRequest();
changeRequest.setValue("short_description", current.variables.short_description);
changeRequest.setValue("cmdb_ci", current.variables.cmdb_ci);
changeRequest.setValue("u_client", current.variables.client);
changeRequest.setValue("u_environment", current.variables.environment);
if (changeRequest.hasValidChoice('priority', current.priority))
    changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.setValue("risk_impact_analysis", current.variables.risk_and_impact_analysis);
changeRequest.setValue("justification", current.variables.justification);
changeRequest.setValue("start_date", current.variables.planned_start_date_ci);
changeRequest.setValue("requested_by", current.request.requested_for);
changeRequest.setValue("parent", current.sys_id);

// Copy the watch list from RITM to CHG
var watchList = new GlideList();
watchList.setTableName("sys_user");
watchList.addQuery("user_name", "IN", current.variables.watch_list.toString());
watchList.query();
var watchListSysIDs = [];
while (watchList.next()) {
    watchListSysIDs.push(watchList.getValue("sys_id"));
}
changeRequest.setValue("watch_list", watchListSysIDs);&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 May 2024 21:57:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920417#M1111175</guid>
      <dc:creator>VarunS</dc:creator>
      <dc:date>2024-05-06T21:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list</title>
      <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920544#M1111184</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/28231"&gt;@Joel O&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure if you are talking about the &lt;EM&gt;watch_list&lt;/EM&gt; field on the RITM.&amp;nbsp;If so, the code should be the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    changeRequest.setValue("watch_list", current.getValue('watch_list'));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you are using a variable, can you share its configuration as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 01:52:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2920544#M1111184</guid>
      <dc:creator>James Chun</dc:creator>
      <dc:date>2024-05-07T01:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list</title>
      <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2921303#M1111412</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/594931"&gt;@James Chun&lt;/a&gt;&amp;nbsp;this is what I was looking to accomplish with using the existing field on the RITM. I tried to go down the route of using variables but this is simpler and easy to add.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 13:55:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2921303#M1111412</guid>
      <dc:creator>Joel O</dc:creator>
      <dc:date>2024-05-07T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance: copy the watchlist from the RITM or from a Variable to CHG watch_list</title>
      <link>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2921305#M1111413</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/684954"&gt;@VarunS&lt;/a&gt;&amp;nbsp;I'll test this out but appreciate your reply.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 13:56:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/assistance-copy-the-watchlist-from-the-ritm-or-from-a-variable/m-p/2921305#M1111413</guid>
      <dc:creator>Joel O</dc:creator>
      <dc:date>2024-05-07T13:56:32Z</dc:date>
    </item>
  </channel>
</rss>

