Service and Support Blog

Service and Support Blog

The Quick Case Close Button

Marco Casalaina Jul 9, 2008

People often ask me how they can get around the Close Case page.  One option to do this is to replace the standard Close Case button with a custom button of your own.  It's remarkably easy to do!  Here's how.

First, go to Setup->Cases->Buttons and Links and make a new custom button called Close Case.  Its Display Type should be set to Detail Page Button, its Behavior to Execute JavaScript, and its Content Source to OnClick JavaScript.

Now you need only paste the following JavaScript in there:

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.Status = 'Closed';
var result = sforce.connection.update([caseObj]);

if (result[0].success=='false') {
     alert(result[0].errors.message);
} else {
     location.reload(true);
}

This is assuming, of course, that you actually have a status called "Closed" -- but if you don't, don't despair -- just change the caseObj.Status = 'Closed'; line to a closed status that actually exists in your case status list.

Now edit your Case page layout.  Click on the Detail Page Buttons box and it will be highlighted, then click the Edit Properties button.  Here you'll be able to hide the standard Close Case button and show your new custom Close Case button.

Finally test your new button by making a test case and closing it.  Voila!  The button sets the case to a closed status and reloads the page to give you feedback that in fact it was closed!

(please note that because this trick uses the API, it will only work for Enterprise Edition and up, or for Professional Edition with the API add-on)

 

3 Comments

Shelly Gralewski

This is a great tool! Have you had anyone request that the Close Case screen (where users can select additional values in order to close the case) not be bypassed? We would like to implement this custom button, however we'd like to allow users the ability to write additional comments, or at least give a reason why Case(s) were mass closed.

Any assistance or suggestions would be greatly appreciated!

Thank you.

Shelly Gralewski

frasuy

It's the simple things like this that go along with user adoption. Great efficiency gainer.

Matt Clausen

My comment is similar to Shelly's. When I click the Close Case button on an open case, I want to go to the close case page, but I want the status field to default to Closed. It seems redundant to push a button to close a case and then have to select close case from the status field? Is there any scripting that can be done to the Close Case button so it can tell the status field to display the value of "closed"?

Post a comment

If you have a TypeKey or TypePad account, please Sign In.