I am trying to setup a button that will allow one to fire assignment rules on a Case without opening the case. Currently I have a Button Setup that is working that for everything other than the assignmentheader option. I am not sure where to assign it to accomplish this. This will make me look like a RockStar so I am hoping that you guys can help me. Thanks.

The Button is a Detail Page Button with a Behavior of Execute JavaScript OnClick JavaScript... Here is the Code


var caseObj = new sforce.SObject("Case");
assignObj = new sforce.SObject("AssignmentRuleHeader");
assignObj.useDefaultRule = 'true';
caseObj.Id = '{!Case.Id}';

caseObj.IsEscalated = 'true';
caseObj.Status = 'Escalated';
var result = sforce.connection.update([caseObj]);

if (result[0].success=='false') {
} else {

Thanks again for the help. I am sure this is easy but I am newer to JavaScript.

1 Answer 1


You can first query the assignment rule Id that you want to set

var assignObj = sforce.connection.query("select id, name from assignmentrule where active='true' and ruletype='assignmentrule' and name='xyz'");
var ruleid = assignObj.getArray("records")[0].get("id");

sforce.connection.AssignmentRuleHeader = {}
sforce.connection.AssignmentRuleHeader.assignmentRuleId=ruleid ;

I have not tried above but i am hoping this is right way to proceed atleast close to solution

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .