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
Shrew DesignsShrew Designs 

Setting Assignment rules from Batch API

Hello,

 

We are funneling leads in using the Batch API from a Ruby On Rails platform.  When the leads come in our assignment rules do not fire.  We tried creating a trigger to update the useDefaultAssignmentRules but this did not help.  I have verified in the debug logs that the trigger is firing, but it does not send the leads through the assignment rules.  All leads are assigned to the user who's Security Token is being used.  

 

Any Ideas?  Below is the trigger we are using:

 

trigger SetAssignmentRuleOnLeadInsert on Lead (before insert) {
    for(Lead theLead : Trigger.New){
        Database.DMLOptions dmo = new Database.DMLOptions();
        dmo.assignmentRuleHeader.useDefaultRule = true;
        theLead.setOptions(dmo);
    }
    
}