Last active
March 17, 2016 17:39
-
-
Save theWill/590f827322fc9e704b04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AssignLeadsUsingAssignmentRules | |
{ | |
@InvocableMethod | |
public static void LeadAssign(List<Id> LeadIds) | |
{ | |
Database.DMLOptions dmo = new Database.DMLOptions(); | |
dmo.assignmentRuleHeader.useDefaultRule= true; | |
List<Lead> Leads = [select id from lead where lead.id in :LeadIds]; | |
for(Lead ld: Leads){ | |
Leads.setOptions(dmo); | |
} | |
if(Leads.size() > 0) | |
{ | |
update Leads; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment