---
schema_version: "1"
id: 7d155b2de204143b38e2d4c1bdd4652e24a92567332d2b2c03131dae3f60c037
title: DmlOptions.AssignmentRuleHeader Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Database_AssignmentRuleHeader.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Database_AssignmentRuleHeader.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: f99afd33306d1a516f09425ef1070ac1806c5c1d43b87b4b4c3cf2e181e00c6c
description: Enables setting assignment rule options.Specifies the ID of a specific assignment rule to run for the case or lead. The assignment rule can be active or inactive.If specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. If specified, do not specify an assignmentRuleId.
---
# DmlOptions.AssignmentRuleHeader Class

Enables setting assignment rule options.

## Namespace

[Database](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Database.htm "The Database namespace provides classes used with DML operations.")

## Example

The following example uses the useDefaultRule option:

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

Lead l = new Lead(company='ABC', lastname='Smith');
l.setOptions(dmo);
insert as user l;

The following example uses the assignmentRuleID option:

Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.assignmentRuleId= '01QXXXXXXXXXXXX';

Lead l = new Lead(company='ABC', lastname='Smith');
l.setOptions(dmo);
insert as user l;

## DmlOptions.AssignmentRuleHeader Properties

The following are properties for DmlOptions.AssignmentRuleHeader.

- **[assignmentRuleID](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Database_AssignmentRuleHeader.htm#apex_Database_AssignmentRuleHeader_assignmentRuleID)**  
    Specifies the ID of a specific assignment rule to run for the case or lead. The assignment rule can be active or inactive.
- **[useDefaultRule](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Database_AssignmentRuleHeader.htm#apex_Database_AssignmentRuleHeader_useDefaultRule)**  
    If specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. If specified, do not specify an assignmentRuleId.

### assignmentRuleID

Specifies the ID of a specific assignment rule to run for the case or lead. The assignment rule can be active or inactive.

#### Signature

public Id assignmentRuleID {get; set;}

#### Property Value

Type: [ID](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm#apex_methods_system_id "Contains methods for the ID primitive data type.")

#### 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

If specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. If specified, do not specify an assignmentRuleId.

#### Signature

public Boolean useDefaultRule {get; set;}

#### Property Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

#### 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.