<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: &#8216;Copy&#8217; UI action for Change requests (Part 2!)</title>
	<atom:link href="http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/</link>
	<description>ServiceNow Consulting Scripting Administration Development</description>
	<lastBuildDate>Wed, 08 Feb 2012 21:54:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mark Stanger</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6652</link>
		<dc:creator>Mark Stanger</dc:creator>
		<pubDate>Wed, 08 Feb 2012 18:51:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6652</guid>
		<description>Hey Paul,

I assume you&#039;re talking about &#039;task_ci&#039;, not &#039;task_group.  If so, the &#039;current.sys_id&#039; line refers to the new change record being created.  The sys_id of the &#039;task_ci&#039; record will be automatically generated so you shouldn&#039;t need to worry about setting it.

Thanks for the feedback on SNCGuru!  Let me know if you&#039;ve got any suggestions.</description>
		<content:encoded><![CDATA[<p>Hey Paul,</p>
<p>I assume you&#8217;re talking about &#8216;task_ci&#8217;, not &#8216;task_group.  If so, the &#8216;current.sys_id&#8217; line refers to the new change record being created.  The sys_id of the &#8216;task_ci&#8217; record will be automatically generated so you shouldn&#8217;t need to worry about setting it.</p>
<p>Thanks for the feedback on SNCGuru!  Let me know if you&#8217;ve got any suggestions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Davidson</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6649</link>
		<dc:creator>Paul Davidson</dc:creator>
		<pubDate>Wed, 08 Feb 2012 14:14:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6649</guid>
		<description>Hi Mark,

I was able to follow your logic to create additional copy modules for the other “Related Lists” that we use on our Change tickets. To ensure appropriate logging, I was careful to manually set all of the table columns like sys_created_by, sys_created_on,  sys_updated_by, sys_updated_on, etc. 

In your copyCI() script you set the ‘task_group’ table’s “task” column to the current.sys_id. I see that the task column is a reference field, so I’m assuming it is referencing the newly created Change ticket’s sys_id. I guess I&#039;m asking if the current object at this point is the Change ticket or the ‘task_group’ record?

What about the sys_id column within the ‘task_group’ table? Are newly created records getting the same sys_id from the existing record that it is copying from? Do I need to manually set the sys_id within ‘task_group’ table?, or is it getting a unique value at Insert?

It is nice that people like you share your effort gained Knowledge with the rest of us, so we can have a starting point for learning ourselves.

Thanks again!
-Paul</description>
		<content:encoded><![CDATA[<p>Hi Mark,</p>
<p>I was able to follow your logic to create additional copy modules for the other “Related Lists” that we use on our Change tickets. To ensure appropriate logging, I was careful to manually set all of the table columns like sys_created_by, sys_created_on,  sys_updated_by, sys_updated_on, etc. </p>
<p>In your copyCI() script you set the ‘task_group’ table’s “task” column to the current.sys_id. I see that the task column is a reference field, so I’m assuming it is referencing the newly created Change ticket’s sys_id. I guess I&#8217;m asking if the current object at this point is the Change ticket or the ‘task_group’ record?</p>
<p>What about the sys_id column within the ‘task_group’ table? Are newly created records getting the same sys_id from the existing record that it is copying from? Do I need to manually set the sys_id within ‘task_group’ table?, or is it getting a unique value at Insert?</p>
<p>It is nice that people like you share your effort gained Knowledge with the rest of us, so we can have a starting point for learning ourselves.</p>
<p>Thanks again!<br />
-Paul</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Stanger</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6553</link>
		<dc:creator>Mark Stanger</dc:creator>
		<pubDate>Wed, 04 Jan 2012 14:30:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6553</guid>
		<description>I&#039;m glad it worked!  It was great to meet you too.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad it worked!  It was great to meet you too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hetzel</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6552</link>
		<dc:creator>Scott Hetzel</dc:creator>
		<pubDate>Wed, 04 Jan 2012 14:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6552</guid>
		<description>Mark..  That worked, perfect.

Thanks for the help!  (also...nice meeting you and Jacob in San Diego in early December)</description>
		<content:encoded><![CDATA[<p>Mark..  That worked, perfect.</p>
<p>Thanks for the help!  (also&#8230;nice meeting you and Jacob in San Diego in early December)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Stanger</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6550</link>
		<dc:creator>Mark Stanger</dc:creator>
		<pubDate>Wed, 04 Jan 2012 00:23:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6550</guid>
		<description>Good catch Scott.  The numbering is controlled by the &#039;getNextObjNumberPadded&#039; line.  The issue in this case is that we&#039;re dealing with the change request context and the change tasks...and that function doesn&#039;t understand both of them.  The only way I know of to get around this is to use a Packages call in place of the standard call.  I&#039;ve updated the scripts above with this fix.  Let me know how it works for you.
[cc lang=&quot;javascript&quot;]
newTask.number = Packages.com.glide.db.NumberManager.getNumber(&#039;change_task&#039;);
[/cc]</description>
		<content:encoded><![CDATA[<p>Good catch Scott.  The numbering is controlled by the &#8216;getNextObjNumberPadded&#8217; line.  The issue in this case is that we&#8217;re dealing with the change request context and the change tasks&#8230;and that function doesn&#8217;t understand both of them.  The only way I know of to get around this is to use a Packages call in place of the standard call.  I&#8217;ve updated the scripts above with this fix.  Let me know how it works for you.</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">newTask.<span style="color: #660066;">number</span> <span style="color: #339933;">=</span> Packages.<span style="color: #660066;">com</span>.<span style="color: #660066;">glide</span>.<span style="color: #660066;">db</span>.<span style="color: #660066;">NumberManager</span>.<span style="color: #660066;">getNumber</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'change_task'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hetzel</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-6548</link>
		<dc:creator>Scott Hetzel</dc:creator>
		<pubDate>Tue, 03 Jan 2012 22:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-6548</guid>
		<description>Mark,

I&#039;m using the first script above and when copying change_tasks it gives me the number prefix defined for the change_request table.  I get RFC1234 instead of the desired CTASK1234.  

Thanks,
Scott</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>I&#8217;m using the first script above and when copying change_tasks it gives me the number prefix defined for the change_request table.  I get RFC1234 instead of the desired CTASK1234.  </p>
<p>Thanks,<br />
Scott</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Stanger</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-3773</link>
		<dc:creator>Mark Stanger</dc:creator>
		<pubDate>Thu, 06 Oct 2011 20:31:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-3773</guid>
		<description>You can override any value on the change request you generate by adding a new &#039;newChange&#039; line in the section of code that copies the change request.  For approval you could do something like this...
[cc lang=&quot;javascript&quot;]
newChange.approval = &#039;not_requested&#039;;
[/cc]

If you don&#039;t want to copy the associated CIs then just comment out this line in the code...
[cc lang=&quot;javascript&quot;]
copyCI(chgID);
[/cc]</description>
		<content:encoded><![CDATA[<p>You can override any value on the change request you generate by adding a new &#8216;newChange&#8217; line in the section of code that copies the change request.  For approval you could do something like this&#8230;</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">newChange.<span style="color: #660066;">approval</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'not_requested'</span><span style="color: #339933;">;</span></div></div>
<p>If you don&#8217;t want to copy the associated CIs then just comment out this line in the code&#8230;</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">copyCI<span style="color: #009900;">&#40;</span>chgID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manny Tsoplakis</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-3754</link>
		<dc:creator>Manny Tsoplakis</dc:creator>
		<pubDate>Thu, 06 Oct 2011 13:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-3754</guid>
		<description>Hi, this works pretty well but when i implement this, the change is copying over with approved as the &quot;approval&quot;.  It is also copying over the journal entries in the activity list.  Also, is there a way to copy the existing record without adding the CI?   thanks</description>
		<content:encoded><![CDATA[<p>Hi, this works pretty well but when i implement this, the change is copying over with approved as the &#8220;approval&#8221;.  It is also copying over the journal entries in the activity list.  Also, is there a way to copy the existing record without adding the CI?   thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Coyne</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-2052</link>
		<dc:creator>Jim Coyne</dc:creator>
		<pubDate>Sun, 20 Mar 2011 10:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-2052</guid>
		<description>Thanks for the article, came in handy with a client.  I was a little confused at first when I saw you were making changes to the &quot;newChange&quot; variable but then used &quot;current.insert();&quot; to make the insert of the record.  I then realized that &quot;var newChange = current;&quot; actually keeps a live connection between both objects, so any change to one affects the other.  I&#039;m no JavaScript expert, but I guess it may not even be worth creating the &quot;newChange&quot; variable at all and just use &quot;current&quot;. </description>
		<content:encoded><![CDATA[<p>Thanks for the article, came in handy with a client.  I was a little confused at first when I saw you were making changes to the &#8220;newChange&#8221; variable but then used &#8220;current.insert();&#8221; to make the insert of the record.  I then realized that &#8220;var newChange = current;&#8221; actually keeps a live connection between both objects, so any change to one affects the other.  I&#8217;m no JavaScript expert, but I guess it may not even be worth creating the &#8220;newChange&#8221; variable at all and just use &#8220;current&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Stanger</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-1855</link>
		<dc:creator>Mark Stanger</dc:creator>
		<pubDate>Wed, 26 Jan 2011 16:17:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-1855</guid>
		<description>Hey, thanks so much for the feedback.  I&#039;ve updated the scripts above to include this fix.  Good catch! </description>
		<content:encoded><![CDATA[<p>Hey, thanks so much for the feedback.  I&#8217;ve updated the scripts above to include this fix.  Good catch!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Oneppo</title>
		<link>http://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests-part-2/comment-page-1/#comment-1854</link>
		<dc:creator>Peter Oneppo</dc:creator>
		<pubDate>Wed, 26 Jan 2011 15:52:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.servicenowguru.com/?p=1838#comment-1854</guid>
		<description>Mark, 
 
This is great.  We just implemented it for one of our clients, but we ran into a small snag.  We were getting duplicate numbers for the copied records.  I think the problem is related to the fact that the customer has the check box for &quot;Assign a task number only upon insert (prevents unused numbers)&quot; under &quot;System Properties -&gt; System&quot; selected. 
 
We solved this problem by adding one line of code to the above script: 
 
var newChange = current; 
newChange.number = getNextObjNumberPadded(); //new line to fix duplicate number problem 
newChange.requested_by_date = &#039;NULL&#039;; 
 
Thanks! 
Peter </description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>This is great.  We just implemented it for one of our clients, but we ran into a small snag.  We were getting duplicate numbers for the copied records.  I think the problem is related to the fact that the customer has the check box for &#8220;Assign a task number only upon insert (prevents unused numbers)&#8221; under &#8220;System Properties -> System&#8221; selected.</p>
<p>We solved this problem by adding one line of code to the above script:</p>
<p>var newChange = current;</p>
<p>newChange.number = getNextObjNumberPadded(); //new line to fix duplicate number problem</p>
<p>newChange.requested_by_date = &#8216;NULL&#8217;;</p>
<p>Thanks!</p>
<p>Peter</p>
]]></content:encoded>
	</item>
</channel>
</rss>

