You need to sign in to do that
Don't have an account?
Akaeding
Custom Case Buttom
I already created the button called "Take Case"
It was requested to do 2 things:
- Assign the current user who clicked on it as the "Case Owner" - I figured this part out.
- Take the current user to the edit page for the case record. - I'm stuck on this.
It is a detail page button, that is executing javascript on click.
Any ideas how I can get it to open the case edit screen?
Try this:
you can quote code by using the Code formatter in the tool bar :)
All Answers
Could you just use this URL?
/{!Case.Id}/e?retURL=%2F{!Case.Id}
I think that's probably pretty close...I got this error text when clicking the button:
A problem with the OnClick JavaScript for this button or link was encountered:
invalid flag after regular expression
invalid Flag?
I am ubernoob...so that means very little to me as far as being able to see the problem in my code.
Here it is:
{!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 {
/{!Case.Id}/e?retURL=%2F'{!Case.Id}'
}
Try this:
you can quote code by using the Code formatter in the tool bar :)
Ahh!
I see it now!
Thanks so much for the help! My new "Take Case" button is in place and doing exactly what it was intended to do:
1. Change the Case Owner to the user that clicks the button
2. Open the Case edit screen, after assigning ownership.
Code Below if anyone wants a "Take Case" button (using the Paste Code button...Thanks again, mpann!):
This is a "Detail Page" button, "execute Javascript" is the behavior, and the content source is "onclick javascript":
{!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 { window.parent.location.href="/{!Case.Id}/e?retURL=%2F{!Case.Id}"; }