function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BJamesBJames 

Ajax Assignment Rule

I've scoured the sforceclient 3.3 source… I cannot find the javascript equivalent of

// Create assignment rule
AssignmentRuleHeader assignment = new AssignmentRuleHeader();
assignment.useDefaultRule = true;
sf.AssignmentRuleHeaderValue = assignment;

I'm trying to fire off an assignment rule while updating a case record.

-=Bryan
DevAngelDevAngel
The assignment rule header is not in the toolkit right now.  I'll see about getting it in there.

If I do, I will be versioning the toolkit to beta3.31 so I don't get flamed!  :smileywink:
SteveBowerSteveBower
I think you want something along the lines of below (note, pseudo code, not running code)

var ar = sforceClient.Query("select id, name from assignmentrule where active='true' and ruletype='assignmentrule' and name='whateverruleyourlookingfor');

// presuming you get only one rule, if you get more, you  have to decide.
var ruleid = ar.records[0].get("id");

var c = Sforce.Dynabean("case");  // or whereever you're getting your Case object from, perhaps a previous query?

c.set("assignmentruleid",ruleid);
OR
c.set("usedefaultrule",true);

c.set("casenumber",.....   etc.   // whatever else you want for the case update.

res = sforceClient.Update(c);


Hope this helps, Steve.

SteveBowerSteveBower
See what happens when you just type pseudo code! :-)   

Ignore my post.  But, thanks Dave for bumping that version number.   :-)

Steve.

DevAngelDevAngel
The assignment rule header is on the method invocation not on the actual sobject.  This means it needs to get set when the session header and other soap headers are being set.  I'm working on this as we speak.
devel1devel1
Any updates on setting the assignment rule header using AJAX Api. I am trying to fire the assignment rules during creation of new case ( from Ajax Custom Control). 
 
Thanks
Raj