<?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: Create automatically a change request from RITM in Virtual Agent forum</title>
    <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210418#M15996</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;you were right about variable names : some of theme has v_name (service =&amp;gt; v_service ... ) : thanks very much&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 15:23:21 GMT</pubDate>
    <dc:creator>yasserbouat</dc:creator>
    <dc:date>2025-03-18T15:23:21Z</dc:date>
    <item>
      <title>Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210314#M15990</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I want to create a change request automaticaaly from RITM when this one is created, and in order to do that I created a business rule as the following but it is not working :&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yasserbouat_0-1742307396817.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/427970iAF236BE0B99113A3/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="yasserbouat_0-1742307396817.png" alt="yasserbouat_0-1742307396817.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Script :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;(function executeRule(current) {

    var chg = new GlideRecord('change_request'); 
    chg.initialize();

    chg.type = current.variables.model.toString();  
	chg.category = current.variables.category.toString();
    chg.short_description = current.variables.short_description.toString();
    chg.priority = current.variables.priority.toString();
    // Ensure service reference is valid
    if (current.variables.service) {
        chg.cmdb_ci = current.variables.service;
    }

    chg.state = 1; // Optional: Defaults to "New"
    var chgSysId = chg.insert();

    if (chgSysId) {
        gs.info('Change Request ' + chgSysId + ' created from RITM ' + current.sys_id);
    } else {
        gs.error('Failed to create Change Request from RITM ' + current.sys_id);
    }

})(current);&lt;/LI-CODE&gt;&lt;P&gt;and the mapping must be with the variables in RITM :&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Model -&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Category -&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Short description -&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Priority -&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;service.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 14:19:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210314#M15990</guid>
      <dc:creator>yasserbouat</dc:creator>
      <dc:date>2025-03-18T14:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210352#M15991</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/837055"&gt;@yasserbouat&lt;/a&gt;&amp;nbsp;, are you not seeing the info message or your change request is not getting created? Your script seems fine.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 14:48:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210352#M15991</guid>
      <dc:creator>GopikaP</dc:creator>
      <dc:date>2025-03-18T14:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210371#M15992</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/747117"&gt;@GopikaP&lt;/a&gt;&amp;nbsp;thanks for your reply : the change request is not getting created !&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 14:56:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210371#M15992</guid>
      <dc:creator>yasserbouat</dc:creator>
      <dc:date>2025-03-18T14:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210380#M15993</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/837055"&gt;@yasserbouat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your script is fine.&lt;/P&gt;
&lt;P&gt;Did you check variable names are correct?&lt;/P&gt;
&lt;P&gt;Did you add log at each line and see which line is breaking?&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 15:00:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210380#M15993</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-03-18T15:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210381#M15994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really prefer a Flow Designer for this functionality or a UI action.&lt;/P&gt;&lt;P&gt;Can you try from flow?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Keerthi&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 15:01:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210381#M15994</guid>
      <dc:creator>KeerthiP</dc:creator>
      <dc:date>2025-03-18T15:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210407#M15995</link>
      <description>&lt;P&gt;Because of the data policies within change management, you're likely creating an invalid Change Record. Instead, use the provided ChangeRequest script include which will create a change record based on these enforced policies. It's also maintainable, as it future proofs against the possible migration to change models.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;
var newChangeGR = ChangeRequest.newChange( current.variables.model.getValue() );
newChangeGR.setValue('category' , current.variables.category.getValue() );
newChangeGR.setValue('short_description' , current.variables.short_description.getValue() );
newChangeGR.setValue('priority' , current.variables.priority.getValue() );

newChangeGR.insert();&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Mar 2025 15:19:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210407#M15995</guid>
      <dc:creator>Kieran Anson</dc:creator>
      <dc:date>2025-03-18T15:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create automatically a change request from RITM</title>
      <link>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210418#M15996</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;you were right about variable names : some of theme has v_name (service =&amp;gt; v_service ... ) : thanks very much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 15:23:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/virtual-agent-forum/create-automatically-a-change-request-from-ritm/m-p/3210418#M15996</guid>
      <dc:creator>yasserbouat</dc:creator>
      <dc:date>2025-03-18T15:23:21Z</dc:date>
    </item>
  </channel>
</rss>

