Skip to main content
added 12 characters in body
Source Link
Ratan Paul
  • 22.8k
  • 14
  • 55
  • 99

Whenever you create a lead from page layout, you need to edit the properties of layout as Lead Assignment Checkbox - Default [ alone not Show on edit page ] and whenever you create a lead through code, you need to this just before you insert or update lead record.

Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; Database.update(Lead Record, dmo);

Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(Lead Record, dmo);

However, Make sure, Lead assignment rule is active and given conditions are correct and the order is as it is supposed.

This will work in all the cases.

Whenever you create a lead from page layout, you need to edit the properties of layout as Lead Assignment Checkbox - Default [ alone not Show on edit page ] and whenever you create a lead through code, you need to this just before you insert or update lead record.

Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; Database.update(Lead Record, dmo);

However, Make sure, Lead assignment rule is active and given conditions are correct and the order is as it is supposed.

This will work in all the cases.

Whenever you create a lead from page layout, you need to edit the properties of layout as Lead Assignment Checkbox - Default [ alone not Show on edit page ] and whenever you create a lead through code, you need to this just before you insert or update lead record.

Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(Lead Record, dmo);

However, Make sure, Lead assignment rule is active and given conditions are correct and the order is as it is supposed.

This will work in all the cases.

Source Link
Soury
  • 131
  • 7

Whenever you create a lead from page layout, you need to edit the properties of layout as Lead Assignment Checkbox - Default [ alone not Show on edit page ] and whenever you create a lead through code, you need to this just before you insert or update lead record.

Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; Database.update(Lead Record, dmo);

However, Make sure, Lead assignment rule is active and given conditions are correct and the order is as it is supposed.

This will work in all the cases.