> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/automation-and-document-lifecycle/configure-email-delivery/duplicate-rules-unable-to-create-no-contact-record.md).

# Duplicate Rules: Unable to Create No Contact Record

The Duplicate Rules are typically setup to prevent duplicate contacts from being created. Typically, clients will have this setup for their contact record.

In some instances the following concern can occur when there is a [No Contact Record](https://sdoc.atlassian.net/wiki/spaces/SDOCS/pages/1009155965/Error+inserting+No+Contact+Record+User+does+not+have+permission+to+create+field+s+on+the+following+object+Contact) in use. Specifically when you are sending an email to a contact that does not exist and using the No Contact Record during contract creation you may see an error like “Duplicate contact cannot be created”. A simple fix is to delete the existing No Contact record, however in the case this is not preferred. You can set up a Duplicate Rule for the No Contact Record to be ignored.

### Instructions

Follow these instructions to create a Duplicate Rule for the No Contact Record to be ignored during contact creation:

1. Go to Setup
2. Then, Duplicate Rules
3. Select Duplicate Rules for Contact records.
4. You can create a condition like: Lastname | not equal to | No Contact Record

#### Validation Rules: Unable to Create No Contact Record

If your org has validation rules that require other Contact fields, S-Docs can't create the No Contact Record and the email fails. S-Docs creates this temporary Contact when you email an address that isn't on any Contact, then deletes it after sending. Use one of these options.

**Option 1 (Recommended): Apex Trigger**

Create a before insert, before update trigger on Contact that fills the fields your validation rules require. The email is sent and logged in **Activity History** on the base record.

```apex
trigger ContactFirstName on Contact (before insert, before update) {
    for (Contact c : trigger.new) {
        if (c.LastName == 'No Contact Record') {
            c.This_Cannot_Be_Null__c = 'some non-null value';
        }
    }
}
```

Test class, if you need coverage:

```apex
@isTest
private class NoContactTestClass {
    @isTest
    public static void noContactTest() {
        Test.startTest();
        Contact testContact = new Contact();
        testContact.LastName = 'No Contact Record';
        insert testContact;
        Test.stopTest();
    }
}
```

**Option 2 (Not Recommended): Create the Record Manually**

Create a Contact with Last Name **No Contact Record** and Email `this.email@is.invalid`, plus every field your validation rules require. First Name is optional (**S-Docs** is suggested). Then add `useExistingNoContactRecord='true'` to your S-Docs button URL:

```apex
{!URLFOR('/apex/SDOC__SDCreate1', null, [id=Opportunity.Id, Object='Opportunity', useExistingNoContactRecord='true'])}
```

{% hint style="warning" %}
With this option, the email is not logged in **Activity History** on the base record.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.sdocs.com/sdocs/automation-and-document-lifecycle/configure-email-delivery/duplicate-rules-unable-to-create-no-contact-record.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
