51

8

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?

Fog Creek Case FC1760336

flag
YES. I want a button on the grid and on the case view: Clone Clones the whole case. – sam jones Jan 5 2012 at 22:25

4 Answers

17

Update: I'm working on a port of Rich's bookmarklet generator script. Up-vote this question if you'd like something like it.

There isn't a built-in way to clone a case to a new one, but there are several options:

  1. You can use this Windows application, written by Michael Pryor. Remember to include api.asp at the end of the URL you give the application.

  2. You can setup this bookmarklet (created by Rich Armstrong) 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 [your fogbugz url] with the address of your fogbugz installation. Line breaks have been added here for readability. The whole thing should be on one line.

    javascript:a=function%20(){%20open('http://**[your fogbugz url]**/
    default.asp?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory
    +'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea
    +'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='
    %20+%20escape(goBug.sCustomerEmail)%20+%20'&ixPriority='
    +goBug.ixPriority+'&sTitle='%20+%20escape(goBug.sTitle)%20+%20
    '&sTags='%20+%20escape(jQuery.map(goBug.ListTagsAsArray(),
    function(val,i){return("\""+val+"\"");}))%20+%20'&sEvent=See%20Case%20'
    %20+%20goBug.ixBug%20+%20escape('\r\n\r\n')%20+%20%20
    escape(document.getSelection())%20+%20'&b=c');%20return;};a();
    

(Here's the same text as above on one line in case you just want to copy it):

        javascript:a=function%20(){%20open('http://**[your fogbugz url]**/default.asp?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory+'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea+'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='%20+%20escape(goBug.sCustomerEmail)%20+%20'&ixPriority='+goBug.ixPriority+'&sTitle='%20+%20escape(goBug.sTitle)%20+%20'&sTags='%20+%20escape(jQuery.map(goBug.ListTagsAsArray(),function(val,i){return("\""+val+"\"");}))%20+%20'&sEvent=See%20Case%20'%20+%20goBug.ixBug%20+%20escape('\r\n\r\n')%20+%20%20escape(document.getSelection())%20+%20'&b=c');%20return;};a();

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.

You can create various new case bookmarklets using Rich's bookmarklet generator, but note that the site is not SSL so your username and password will go in cleartext.

  1. 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 Plugin API documentation and the Plugin ideas forum.

See also this blog post about creating cases with field values pre-filled: http://blog.fogcreek.com/a-halloween-treat/

link|flag
Great! For me the following works even a bit better: javascript:open('/?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory+'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea+'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='+escape(goBug.sCustomerEmail)+'&ixPriority='+goBug.ixPriority+'&sTitle='+escape(goBug.sTitle)+'&sTags='+escape(goBug.ListTagsAsArray())+'&sEvent=See%20case%20'+goBug.ixBug+'.'+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,'%20').replace(/\+/ig,'%252B')+'&b=c');void(0); – Michel de Ruiter May 31 2010 at 15:42
1 
My latest version, also copying the milestone: javascript:open('/?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory+'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea+'&ixFixFor='+goBug.ixFixFor+'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='+escape(goBug.sCustomerEmail)+'&ixPriority='+goBug.ixPriority+'&sTags='+escape(goBug.ListTagsAsArray())+'&sEvent=See case '+goBug.ixBug+': '+escape(goBug.sTitle)+'.'+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,' ').replace(/\+/ig,'%252B')+'&b=c');void(0); – Michel de Ruiter Aug 25 2010 at 10:03
@adambox: the Zombie Watch link in the blog post should be... undead? – Michel de Ruiter Nov 15 2011 at 21:34
@michel thanks, I'll get that fixed! – adambox Nov 18 2011 at 15:54
@adambox please do :-) – Michel de Ruiter Jan 10 2012 at 8:02
show 1 more comment
3

I wrote an app which allows you to do this (source available).

http://www.fogcreek.com/fogbugz/blog/post/CaseCloner-for-batch-creating-cases-in-FogBugz.aspx

Just remember, the URL field it wants is the actual url to the api, so something like

https://myfogbugz.com/api.asp

link|flag
2

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.

name:          FB Clone
description:   Adds 'Clone' links to left hand side
author:        apfrod/Rich Armstrong
version:       1.0.0.0

js:

if(goBug && goBug.ixBug !== 0) {
    var clone = '<p><a href="#" id="clone_new">Clone as new case</a></p><p><a href="#" id="clone_subcase">Clone as subcase</a></p>';
    $('#bugviewContainerSide').append(clone);

    $('#clone_new').click(function(){
    window.open('/fogbugz/?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory+'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea+'&ixFixFor='+goBug.ixFixFor+'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='+escape(goBug.sCustomerEmail)+'&ixPriority='+goBug.ixPriority+'&sTags='+escape(goBug.ListTagsAsArray())+'&sEvent=See case '+goBug.ixBug+': '+escape(goBug.sTitle)+'.'+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,' ').replace(/\+/ig,'%252B')+'&b=c');void(0);
        });

    $('#clone_subcase').click(function(){
    window.open('/fogbugz/?command=new&pg=pgEditBug&ixCategory='+goBug.ixCategory+'&ixBugParent='+goBug.ixBug+'&ixProject='+goBug.ixProject+'&ixArea='+goBug.ixArea+'&ixFixFor='+goBug.ixFixFor+'&ixPersonAssignedTo='+goBug.ixPersonAssignedTo+'&sCustomerEmail='+escape(goBug.sCustomerEmail)+'&ixPriority='+goBug.ixPriority+'&sTags='+escape(goBug.ListTagsAsArray())+'&sEvent='+escape('\n\n'+document.getSelection()).replace(/%25A0/ig,' ').replace(/\+/ig,'%252B')+'&b=c');void(0);
        });
    }

I've also added a custom field to this using the following to get the field, and adding the string to the url:

if ($('label[for=idBugViewDialogItemclientS15]').length > 0) {
    goBug.clientS15 = $('label[for=idBugViewDialogItemclientS15]').next().html() || '';
    goBug.clientS15 = '&clientS15=' + goBug.clientS15;
}
link|flag
I've added a custom field to this using the following to get the field, and adding the string to the url. if ($('label[for=idBugViewDialogItemclientS15]').length > 0){ goBug.clientS15 = $('label[for=idBugViewDialogItemclientS15]').next().html() || ''; goBug.clientS15 = '&clientS15=' + goBug.clientS15; } – apfrod Nov 21 2011 at 10:00
0

I also started with 'WTF, no clone case here?', but after some thinking we rather use the bug hierarchy.

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.

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. :)

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.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.