# DuplicateRuleHeader

Determines options for using duplicate rules to detect duplicate records. Duplicate rules are part of the Duplicate Management feature.

## API Calls

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

**See Also**

- [DuplicateResult](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_duplicateresult.htm)
- [DuplicateRule](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_duplicaterule.htm)

## Fields

### `allowSave`

**Type:** boolean

**Description:** For a duplicate rule, when the Alert option is enabled, bypass alerts and save duplicate records by setting this property to `true`. Prevent duplicate records from being saved by setting this property to `false`.

### `includeRecordDetails`

**Type:** boolean

**Description:** Get fields and values for records detected as duplicates by setting this property to `true`. Get only record IDs for records detected as duplicates by setting this property to `false`.

### `runAsCurrentUser`

**Type:** boolean

**Description:** Make sure that sharing rules for the current user are enforced when duplicate rules run by setting this property to `true`. Use the sharing rules specified in the class for the request by setting this property to `false`. If no sharing rules are specified, Apex code runs in system context and sharing rules for the current user are not enforced.

## Java Sample

This sample shows how to use the `DuplicateRuleHeader` to set options for using duplicate rules. To see the entire sample application, see [DuplicateResult](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_duplicateresult.htm).

```class
_DuplicateRuleHeader header = new _DuplicateRuleHeader();
        header.setAllowSave(false);
        header.setIncludeRecordDetails(true);
        header.setRunAsCurrentUser(true);

        binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "DuplicateRuleHeader", header);
```
