44

6

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 at 22:25

5 Answers

14

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();
    

    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.

  3. 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 at 21:34
@michel thanks, I'll get that fixed! – adambox Nov 18 at 15:54
@adambox please do :-) – Michel de Ruiter Jan 10 at 8:02
show 1 more comment
2

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 at 10:00
0

Is it possible to have that bookmarklet also copy release notes?

link|flag
release notes can only be entered on a case which has been resolved, so they can't be added to this bookmarklet, which creates a newly-opened case – adambox Aug 16 2010 at 13:46
see this post for a feature request to make the release notes field editable for active cases: fogbugz.stackexchange.com/questions/6915/… – adambox Apr 25 at 13:44
0

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(goBug.ListTagsAsArray())%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();

any suggestions on how to make this copy custom fields?

link|flag
custom fields don't currently add themselves to the javascript "goBug" object, so they aren't available to be pulled out – adambox Apr 25 at 13:53
Sorry, but does this mean it's not possible to clone cases with custom fields intact? Also, I'd really like to see a "clone" button in the standard interface instead of this bookmarklet. It seems to be a popular need based on the number of responses and votes in this question... Can we make it a feature request please? – Jared Jun 2 at 20:09
apfrod has found a way to copy custom field values: fogbugz.stackexchange.com/questions/1075/… – adambox Nov 21 at 14:42

Your Answer

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