You need to sign in to do that
Don't have an account?
sirwiley
Need code/objects for custom button allowing: change status, change case owner, add comment
Need code/objects for custom "Escalate" button on the case detail page that opens a window to allow support users to complete the following fields on the case object:
- Change the status (escalation should be the only choice in the drop-down),
- Change the case owner, and
- Add a comment
We will try to find information ourselves but any guidance appreciated.
I've got this so far, which seems to work, for Custom Button, behavior: execute javascript to just change status (See bottom below), but I need to open a new window, I guess, and allow user to select a different case owner and add a comment: (not sure how to do this yet)
URLs for Change owner and new comment for a certain case: (How to make these dynamic for this escalate button?)
https://na9.salesforce.com/500E0000003mvi6/a?retURL=%2F500E0000003mvi6
https://na9.salesforce.com/00a/e?parent_id=500E0000003mvi6&retURL=%2F500E0000003mvi6
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.Status = 'Escalated';
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
The following is working but users would like: the add comments window not open in a new tab, but wouldlike to stay in current tab like the behavior of the Close Case button. Need help with the syntax for changing this minor window opening preference.
I've tried scrUp and srcSelf but think these require apex objects. Probably something simple but cant seem to get it working.
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
parent.ID='{!Case.ParentId}'
caseObj.OwnerId = '00Gc0000000FXfv';
caseObj.Status = 'Escalated';
window.open('/00a/e?parent_id={!Case.Id}&retURL=/{!Case.Id}');
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.Status = 'Escalated';
var result = sforce.connection.update([caseObj]);
if (result[0].success == 'false') {
alert(result[0].errors.message);
} else {
parent.ID = '{!Case.ParentId}';
window.parent.location = ('/00a/e?parent_id={!Case.Id}&IsPublished=1&retURL=/{!Case.Id}');
}