# Connecting S-Docs to Your Customer Records

Once you have successfully installed S-Docs, the next step is configuring the application to recognize the specific Salesforce objects you plan to use for document generation.

To ensure S-Docs works seamlessly with your desired objects—whether they are standard Salesforce objects or custom ones—you must ensure the proper relational architecture is in place.

### Step 1: Ensure a Lookup Field Exists on the `SDoc Relationship` Object

To associate generated documents with your records, a lookup field linking to your target object must exist on the `SDoc Relationship` object. This acts as the necessary relational bridge in your Salesforce backend.

We commonly provide these lookup fields out-of-the-box for standard objects such as Account, Opportunity, and others. Before creating a new field, check if one already exists for your target object. If the lookup field already exists, feel free to leave it be and move on to the next step in your setup.

If it does not exist (which is always the case for Custom Objects, and occasionally the case for specific Standard Objects), follow these standardized steps to create it:

1. In the Setup menu (the gear icon in the upper right corner), navigate to the Object Manager tab.
2. Search for and select the `SDoc Relationship` object.
3. Click Fields & Relationships in the left sidebar, then click New.
4. Select Lookup Relationship as the Data Type and click Next.
5. Select your target object (e.g., `CustomObj__c` or your standard object) from the "Related To" dropdown menu and click Next.
6. Enter your Field Label and Field Name.
   * Crucial Naming Rule: The Field Name must be your exact object name without the "\_\_c". For example, if your object's API name is `CustomObj__c`, your Field Name should simply be `CustomObj`. Click Next.
7. Establish field-level security by ensuring the checkbox is visible for all relevant users. Click Next.
8. Leave the default layout settings as they are and click Save.

> Note for AppExchange Packages: If your target object's API name includes a package domain (e.g., `package__CustomObj__c`), Salesforce does not allow double underscores in the new field name. You will need to replace the first double underscore with "*u*" and remove the remaining "\_\_c". In this scenario, your field name must be set exactly to: `package_u_CustomObj`.

### Step 2: Update the S-Doc Template Picklist (Custom Objects Only) \[Optional]

If you are configuring S-Docs to work with a Custom Object, you must complete this additional step. This enables you to create new S-Docs templates that are specifically related to your custom object.

> Info: This section uses a sample custom object named CustomObj with an API name of CustomObj\_\_c. Substitute this with the exact API name of your actual custom object.

1. Navigate to the Setup menu and click the Object Manager tab.
2. Search for and select the S-Doc Template object.
3. Click on Fields & Relationships in the left sidebar.
4. Search for and click on the Related to Type field.
5. Scroll down to the Values section and click the New button.
6. Enter your custom object’s API name (e.g., `CustomObj__c`) as a picklist value.
7. Click Save.

> Note for AppExchange Packages: If you are using S-Docs with another AppExchange managed package, your custom object API name should include the domain name of the package followed by two underscores and then the object name (e.g., `package__CustomObj__c`). You must use the entire API name for the S-Docs picklist value.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/quick-start/getting-started/set-up-object-relationships.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
