Feature Request: Clone a case or create a case from a template - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2013-05-19T07:42:54Z http://fogbugz.stackexchange.com/feeds/question/1075 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/1075/feature-request-clone-a-case-or-create-a-case-from-a-template Feature Request: Clone a case or create a case from a template adambox 2009-12-16T22:49:57Z 2012-10-02T16:08:31Z <p>How do I create a new case that looks just like an existing one (all the fields the same) so I can quickly use a case as a template for a new one?</p> <blockquote> <p><img src="http://www.gravatar.com/avatar/baf927dcc0b0c5d0f41dece1e575aa0f?s=32&amp;d=identicon&amp;r=PG" alt="Fog Creek"> <a href="http://fogbugz.stackexchange.com/questions/1023/whats-that-kiwi-logo-and-case-number-at-the-bottom-of-my-feature-request" rel="nofollow">Case FC1760336</a></p> </blockquote> http://fogbugz.stackexchange.com/questions/1075/feature-request-clone-a-case-or-create-a-case-from-a-template/1076#1076 Answer by adambox for Feature Request: Clone a case or create a case from a template adambox 2009-12-16T23:03:53Z 2012-10-02T16:08:31Z <p><strong>Update:</strong> I'm working on a port of Rich's bookmarklet generator script. Up-vote <a href="http://fogbugz.stackexchange.com/questions/2449/how-can-i-make-bookmarklets-to-create-various-types-of-new-cases-in-fogbugz" rel="nofollow">this question</a> if you'd like something like it.</p> <p>There isn't a built-in way to clone a case to a new one, but there are several options:</p> <ol> <li><p>You can use <a href="http://www.fogcreek.com/fogbugz/blog/post/CaseCloner-for-batch-creating-cases-in-FogBugz.aspx" rel="nofollow">this Windows application</a>, written by <a href="http://fogbugz.stackexchange.com/users/14/michael-pryor" rel="nofollow">Michael Pryor</a>. Remember to include api.asp at the end of the URL you give the application.</p></li> <li><p>You can setup this bookmarklet (created by <a href="http://fogbugz.stackexchange.com/users/6/rich-armstrong" rel="nofollow">Rich Armstrong</a>) to open a new case edit with most of the fields copied. To set it up in your browser, create a new bookmark in your bookmarks bar. Set the address / URL of the bookmark to the following, replacing <strong>[your fogbugz url]</strong> with the address of your fogbugz installation. <em>Line breaks have been added here for readability. The whole thing should be on one line.</em></p> <pre><code>javascript:a=function%20(){%20open('http://**[your fogbugz url]**/ default.asp?command=new&amp;pg=pgEditBug&amp;ixCategory='+goBug.ixCategory +'&amp;ixProject='+goBug.ixProject+'&amp;ixArea='+goBug.ixArea +'&amp;ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&amp;sCustomerEmail=' %20+%20escape(goBug.sCustomerEmail)%20+%20'&amp;ixPriority=' +goBug.ixPriority+'&amp;sTitle='%20+%20escape(goBug.sTitle)%20+%20 '&amp;sTags='%20+%20escape(jQuery.map(goBug.ListTagsAsArray(), function(val,i){return("\""+val+"\"");}))%20+%20'&amp;sEvent=See%20Case%20' %20+%20goBug.ixBug%20+%20escape('\r\n\r\n')%20+%20%20 escape(document.getSelection())%20+%20'&amp;b=c');%20return;};a(); </code></pre></li> </ol> <p>(Here's the same text as above on one line in case you just want to copy it):</p> <pre><code> javascript:a=function%20(){%20open('http://**[your fogbugz url]**/default.asp?command=new&amp;pg=pgEditBug&amp;ixCategory='+goBug.ixCategory+'&amp;ixProject='+goBug.ixProject+'&amp;ixArea='+goBug.ixArea+'&amp;ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&amp;sCustomerEmail='%20+%20escape(goBug.sCustomerEmail)%20+%20'&amp;ixPriority='+goBug.ixPriority+'&amp;sTitle='%20+%20escape(goBug.sTitle)%20+%20'&amp;sTags='%20+%20escape(jQuery.map(goBug.ListTagsAsArray(),function(val,i){return("\""+val+"\"");}))%20+%20'&amp;sEvent=See%20Case%20'%20+%20goBug.ixBug%20+%20escape('\r\n\r\n')%20+%20%20escape(document.getSelection())%20+%20'&amp;b=c');%20return;};a(); </code></pre> <p>When you view a case and click the bookmarklet, it will open a new case in a new window/tab that's a clone of the case. It will include "See Case XXX" to link back to the other one. You can remove this from the URL of the bookmarklet if you want. If you click it with some text selected, that text is put in the body of the new case as well.</p> <p>You can create various new case bookmarklets using <a href="http://fogbugz.stackexchange.com/questions/2449/how-can-i-make-bookmarklets-to-create-various-types-of-new-cases-in-fogbugz/2701#2701" rel="nofollow">Rich's bookmarklet generator</a>, but note that the site is not SSL so your username and password will go in cleartext.</p> <ol> <li>With the new plugin architecture in FogBugz 7, one could write a plugin to add a "clone case" button to the case view. See the <a href="https://developers.fogbugz.com/default.asp?W1" rel="nofollow">Plugin API documentation</a> and the <a href="http://fogbugzplugins.uservoice.com/pages/20251-fogbugz-plugin-ideas" rel="nofollow">Plugin ideas forum</a>.</li> </ol> <p>See also this blog post about creating cases with field values pre-filled: <a href="http://blog.fogcreek.com/a-halloween-treat/" rel="nofollow">http://blog.fogcreek.com/a-halloween-treat/</a></p> http://fogbugz.stackexchange.com/questions/1075/feature-request-clone-a-case-or-create-a-case-from-a-template/1079#1079 Answer by Michael Pryor for Feature Request: Clone a case or create a case from a template Michael Pryor 2009-12-16T23:12:19Z 2010-02-11T18:44:04Z <p>I wrote an app which allows you to do this (source available).</p> <p><a href="http://www.fogcreek.com/fogbugz/blog/post/CaseCloner-for-batch-creating-cases-in-FogBugz.aspx" rel="nofollow">http://www.fogcreek.com/fogbugz/blog/post/CaseCloner-for-batch-creating-cases-in-FogBugz.aspx</a></p> <p>Just remember, the URL field it wants is the <em>actual</em> url to the api, so something like</p> <p><a href="https://myfogbugz.com/api.asp" rel="nofollow">https://myfogbugz.com/api.asp</a></p> http://fogbugz.stackexchange.com/questions/1075/feature-request-clone-a-case-or-create-a-case-from-a-template/9567#9567 Answer by apfrod for Feature Request: Clone a case or create a case from a template apfrod 2011-11-18T11:37:26Z 2011-11-21T14:41:35Z <p>I've just converted this into a 'customization' (Settings > Customizations) so it will add a link to the page to do it rather than as a bookmarklet.</p> <pre><code>name: FB Clone description: Adds 'Clone' links to left hand side author: apfrod/Rich Armstrong version: 1.0.0.0 js: if(goBug &amp;&amp; goBug.ixBug !== 0) { var clone = '&lt;p&gt;&lt;a href="#" id="clone_new"&gt;Clone as new case&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#" id="clone_subcase"&gt;Clone as subcase&lt;/a&gt;&lt;/p&gt;'; $('#bugviewContainerSide').append(clone); $('#clone_new').click(function(){ window.open('/fogbugz/?command=new&amp;pg=pgEditBug&amp;ixCategory='+goBug.ixCategory+'&amp;ixProject='+goBug.ixProject+'&amp;ixArea='+goBug.ixArea+'&amp;ixFixFor='+goBug.ixFixFor+'&amp;ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&amp;sCustomerEmail='+escape(goBug.sCustomerEmail)+'&amp;ixPriority='+goBug.ixPriority+'&amp;sTags='+escape(goBug.ListTagsAsArray())+'&amp;sEvent=See case '+goBug.ixBug+': '+escape(goBug.sTitle)+'.'+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,' ').replace(/\+/ig,'%252B')+'&amp;b=c');void(0); }); $('#clone_subcase').click(function(){ window.open('/fogbugz/?command=new&amp;pg=pgEditBug&amp;ixCategory='+goBug.ixCategory+'&amp;ixBugParent='+goBug.ixBug+'&amp;ixProject='+goBug.ixProject+'&amp;ixArea='+goBug.ixArea+'&amp;ixFixFor='+goBug.ixFixFor+'&amp;ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&amp;sCustomerEmail='+escape(goBug.sCustomerEmail)+'&amp;ixPriority='+goBug.ixPriority+'&amp;sTags='+escape(goBug.ListTagsAsArray())+'&amp;sEvent='+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,' ').replace(/\+/ig,'%252B')+'&amp;b=c');void(0); }); } </code></pre> <p>I've also added a custom field to this using the following to get the field, and adding the string to the url:</p> <pre><code>if ($('label[for=idBugViewDialogItemclientS15]').length &gt; 0) { goBug.clientS15 = $('label[for=idBugViewDialogItemclientS15]').next().html() || ''; goBug.clientS15 = '&amp;clientS15=' + goBug.clientS15; } </code></pre> http://fogbugz.stackexchange.com/questions/1075/feature-request-clone-a-case-or-create-a-case-from-a-template/10283#10283 Answer by pasa for Feature Request: Clone a case or create a case from a template pasa 2012-04-17T11:28:02Z 2012-04-17T11:28:02Z <p>I also started with 'WTF, no clone case here?', but after some thinking we rather use the bug hierarchy. </p> <p>In our work clone is needed because the same bug is present on different releases, and patching, especially release process is different. As the parent item is just one click away it serves well, and information is not duplicated.</p> <p>The only problem was the Release notes, for which I wrote a simple tool that is enhanced version of FB's release notes view. We use special words in RN, 'NA' fir intentionally empty, 'Parent' to find the note in the parent bug. So that information is not duplicated either, and everyone gets the one true version of the text. :)</p> <p>So I no longer need Bugzilla-like cloning. OTOH 'template' bugs would be great to have. Snippets can be used for the text part, and certainly it is possible to post the bug with an external tool in a templated state, but that all is hassle. 'New Case' could have a dropdown to pick a template from a list. A template just a selection of fields and their initial value.</p>