Skip to content

Instantly share code, notes, and snippets.

@theWill
Created July 10, 2017 15:52
Show Gist options
  • Save theWill/200d3d32e84e88c09c5215ec24779921 to your computer and use it in GitHub Desktop.
Save theWill/200d3d32e84e88c09c5215ec24779921 to your computer and use it in GitHub Desktop.
Brian's Code
public class AssignLeadsUsingAssignmentRules
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
Lead Leads=[select id from lead where lead.id in :LeadIds];
Leads.setOptions(dmo);
update Leads;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment