You need to sign in to do that
Don't have an account?
Custom Button:Below code is working in detail button but not working in list button.
Hi the below code is assinging the case to the loged in user . It works fine when the detail button is created with the javascript code but its not working when the list button is created with the same code[It will enter the else loop].
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseid = "{!Case.Id}";
var userid = "{!$User.Id}";
var CaseToUpdate = new sforce.SObject("Case");
CaseToUpdate.set("Id", caseid);
CaseToUpdate.set("OwnerId", userid);
var Result = sforce.connection.update([CaseToUpdate]);
if(Result[0].getBoolean("success"))
{
function redirect() { parent.frames.location.replace("/{!Case.Id}"); }
redirect();
}
else {
alert("Error");
}
Please help me on this
Thanks
I'm glad I could help, please mark as resolved for future generations :)
Have a great day!
All Answers
Hi,
When you are in list button the line:
"var caseid = "{!Case.Id}"; "
has no meaning.
You need to use the list view methuds of getting IDs:
{!GETRECORDIDS( $ObjectType.Case)};
I hope that helps,
Roy Gilad
I'm glad I could help, please mark as resolved for future generations :)
Have a great day!