How assign assignment rule to Lead using apex?

Sample Code:

Lead led = new Lead();

Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
led.setOptions(dmo);

insert led;

this is applicable even when you update the Lead.

No comments:

Post a Comment