Custom Button to take Ownership for Case Record
Create a new Detail Button on the Case object.
Set Behavior to Execute JavaScript and Content Source to OnClick JavaScript
Paste the Below snippet of code in the window
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
}
else {
href= "https://cs16.salesforce.com/ui/support/servicedesk/ServiceDeskPage#/{!Case.Id}" ; // return to console
document.location.reload(true) // Refresh the Tab
}
alert(result[0].errors.message);
}
else {
href= "https://cs16.salesforce.com/ui/support/servicedesk/ServiceDeskPage#/{!Case.Id}" ; // return to console
document.location.reload(true) // Refresh the Tab
}
Note : Change the return URL to Current URL.
Enjoy Coding !!
Comments
Post a Comment