Newer Version Available
DmlOptions.AssignmentRuleHeader Class
Namespace
Example
1Database.DMLOptions dmo = new Database.DMLOptions();
2dmo.assignmentRuleHeader.useDefaultRule= true;
3
4Lead l = new Lead(company='ABC', lastname='Smith');
5l.setOptions(dmo);
6insert l;1Database.DMLOptions dmo = new Database.DMLOptions();
2dmo.assignmentRuleHeader.assignmentRuleId= '01QD0000000EqAn';
3
4Lead l = new Lead(company='ABC', lastname='Smith');
5l.setOptions(dmo);
6insert l;DmlOptions.AssignmentRuleHeader Properties
The following are properties for DmlOptions.AssignmentRuleHeader.
assignmentRuleID
Signature
public Id assignmentRuleID {get; set;}
Property Value
Type: ID
Usage
The ID can be retrieved by querying the AssignmentRule sObject. If specified, do not specify useDefaultRule.
If the value is not in the correct ID format (15-character or 18-character Salesforce ID), the call fails and an exception is returned.
useDefaultRule
Signature
public Boolean useDefaultRule {get; set;}
Property Value
Type: Boolean
Usage
If there are no assignment rules in the organization, in API version 29.0 and earlier, creating a case or lead with useDefaultRule set to true results in the case or lead being assigned to the predefined default owner. In API version 30.0 and later, the case or lead is unassigned and doesn't get assigned to the default owner.