# AssignmentRuleHeader

The `AssignmentRuleHeader` must be specified in the `create()` or `update()` call of a Case or Lead for the specified assignment rule to be applied, and it must be specified in the `update()` call of an Account for the territory assignment rules to be applied.

## API Calls

[`create()`](/docs/platform/api/guide/sforce-api-calls-create.md), [`merge()`](/docs/platform/api/guide/sforce-api-calls-merge.md), [`update()`](/docs/platform/api/guide/sforce-api-calls-update.md), [`upsert()`](/docs/platform/api/guide/sforce-api-calls-create.md)

**See Also**

- [AssignmentRule](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_assignmentrule.htm)

## Fields

### `assignmentRuleId`

**Type:** ID

**Description:** The ID of a specific assignment rule to run for the Case or Lead. The assignment rule can be active or inactive. The ID can be retrieved by querying the [AssignmentRule](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_assignmentrule.htm) object. If specified, do not specify `useDefaultRule`. This element is ignored for accounts, because all territory assignment rules are applied. If the value is not in the correct ID format (15-character or 18-character Salesforce ID), the call fails and a [`MALFORMED_ID`](/docs/platform/api/guide/sforce-api-calls-concepts-core-data-objects.md#exceptioncode) exception is returned.

### `useDefaultRule`

**Type:** boolean

**Description:** If `true` for a Case or Lead, uses the default (active) assignment rule for a Case or Lead. If specified, don’t specify an `assignmentRuleId`. If `true` for an Account, all territory assignment rules are applied. If `false` for an Account, no territory assignment rules are applied.

## Sample Code

For a code example, see [Lead](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_lead.htm).
