You need to sign in to do that
Don't have an account?

Take Ownership Button (Not working for users)
Hi!
I have the following button on a page layout for my users that use cases. The button works great when I login (admin). However, when I login as the user nothing happens when the button is clicked. It appears the page refreshes but no information changes. Can anyone suggest why this is happening? Is it permission related?
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
var updateRecord = new Array();
var myquery = "SELECT Id FROM Case WHERE Id = '{!Case.Id}' limit 1";
result = sforce.connection.query(myquery);
records = result.getArray("records");
if(records[0])
{
var update_Case = records[0];
update_Case.OwnerId = "{!$User.Id}";
update_Case.Status = "In Progress";
updateRecord.push(update_Case);
}
result = sforce.connection.update(updateRecord);
parent.location.href = parent.location.href;
I have the following button on a page layout for my users that use cases. The button works great when I login (admin). However, when I login as the user nothing happens when the button is clicked. It appears the page refreshes but no information changes. Can anyone suggest why this is happening? Is it permission related?
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
var updateRecord = new Array();
var myquery = "SELECT Id FROM Case WHERE Id = '{!Case.Id}' limit 1";
result = sforce.connection.query(myquery);
records = result.getArray("records");
if(records[0])
{
var update_Case = records[0];
update_Case.OwnerId = "{!$User.Id}";
update_Case.Status = "In Progress";
updateRecord.push(update_Case);
}
result = sforce.connection.update(updateRecord);
parent.location.href = parent.location.href;
The user does have API access and access to the record. The record saves fine by changing ownership manully and saving the record. It's just the button that isn't working.
It looks like it is conflicting with two validation rule (do not allow the users to reopen a closed case and case owner cannot be changed on a closed case).
The cases are new and the validation rules should only be on closed cases. The code of the validation rules are below. Can you tell me if there is another user I should be excluding to get this to work (the validation rule should be working on the user I am logging in as, however) or of there is something else I can do to make both work together? Thanks!
AND(
ISCHANGED(Status),
ISPICKVAL(PRIORVALUE(Status), "Closed"),
Owner:User.Id <> LastModifiedBy.Id,
$Profile.Name <> "System Administrator",
$User.Id <> '00580000003xxYl'
)
AND(
IsClosed,
ISCHANGED(OwnerId),
$Profile.Name <> "System Administrator",
$User.Id <> '00580000003xxYl'
)
Thanks again so much!
Melissa