> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

> Connect Qwoty to Salesforce and automatically synchronize customers, contacts, opportunities, products, quotes, and orders.

## Overview

The Salesforce integration synchronizes your commercial data between Qwoty and Salesforce.

Once Salesforce is connected, the integration setup starts automatically. No manual workflow configuration is required.

<Info>
  Qwoty automatically prepares the synchronization flow after the Salesforce connection is authorized.
</Info>

## Data synchronization

```mermaid theme={null}
flowchart LR
    subgraph QWOTY["Qwoty"]
        direction TB
        Q_CUSTOMER["Customer"]
        Q_CONTACT["Primary contact"]
        Q_QUOTE["Project (Quote)"]
        Q_LINE_ITEMS["Line items"]
        Q_PHASES["Phases"]
        Q_ORDER["Order<br/>on acceptance"]
        Q_PRODUCT["Product"]
    end

    subgraph SALESFORCE["Salesforce"]
        direction TB
        SF_ACCOUNT["Account"]
        SF_CONTACT["Contact"]
        SF_OPPORTUNITY["Opportunity"]
        SF_LINE_ITEM["OpportunityLineItem"]
        SF_SCHEDULE["OpportunityLineItemSchedule"]
        SF_ORDER["Order + OrderItem"]
        SF_PRODUCT["Product2 + PricebookEntry"]
    end

    Q_CUSTOMER --> SF_ACCOUNT
    Q_CONTACT --> SF_CONTACT
    Q_QUOTE -->|"PATCH"| SF_OPPORTUNITY
    Q_LINE_ITEMS -->|"CREATE"| SF_LINE_ITEM
    Q_PHASES -->|"CREATE"| SF_SCHEDULE
    Q_ORDER -->|"CREATE"| SF_ORDER
    Q_PRODUCT -->|"UPSERT"| SF_PRODUCT

    classDef qwoty fill:#EFF6FF,stroke:#005FFF,color:#0F172A,stroke-width:1.5px;
    classDef salesforce fill:#F8FAFC,stroke:#64748B,color:#0F172A,stroke-width:1.5px;

    class Q_CUSTOMER,Q_CONTACT,Q_QUOTE,Q_LINE_ITEMS,Q_PHASES,Q_ORDER,Q_PRODUCT qwoty;
    class SF_ACCOUNT,SF_CONTACT,SF_OPPORTUNITY,SF_LINE_ITEM,SF_SCHEDULE,SF_ORDER,SF_PRODUCT salesforce;

    style QWOTY fill:transparent,stroke:#CBD5E1,stroke-width:1px
    style SALESFORCE fill:transparent,stroke:#CBD5E1,stroke-width:1px
```

<AccordionGroup>
  <Accordion title="Customers and contacts" icon="users">
    A Qwoty **Customer** is synchronized with a Salesforce **Account**.

    ```text theme={null}
    The customer's **primary contact** is synchronized with a Salesforce
    **Contact**.
    ```
  </Accordion>

  <Accordion title="Projects and opportunities" icon="briefcase">
    A Qwoty **Project (Quote)** is associated with a Salesforce **Opportunity**.

    ```text theme={null}
    When the project changes in Qwoty, the corresponding opportunity is
    updated using a `PATCH` operation.
    ```
  </Accordion>

  <Accordion title="Line items and phases" icon="list">
    Each Qwoty quote line item creates a Salesforce **OpportunityLineItem**.

    ```text theme={null}
    Each phase associated with a line item creates an
    **OpportunityLineItemSchedule**.
    ```
  </Accordion>

  <Accordion title="Orders" icon="cart-shopping">
    When a quote is accepted, Qwoty creates the corresponding Salesforce **Order** and **OrderItem** records.
  </Accordion>

  <Accordion title="Products and pricing" icon="box">
    A Qwoty **Product** is synchronized with Salesforce **Product2** and **PricebookEntry** records.

    ```text theme={null}
    The synchronization uses an `UPSERT` operation:

    - Existing records are updated.
    - Missing records are created.
    ```
  </Accordion>
</AccordionGroup>

## Before you connect

Make sure that:

\* You have access to your Qwoty workspace settings. \* You can authorize access to the target Salesforce organization. \* Your Salesforce user has permission to access the objects used by the integration. \* Products that should be synchronized contain the required pricing information.

<Warning>
  Missing Salesforce permissions may prevent some records from being created or updated.
</Warning>

## Connect Salesforce

<Steps>
  <Step title="Open the integrations settings">
    In Qwoty, open your workspace settings and navigate to **Integrations**.
  </Step>

  <Step title="Select Salesforce">
    Find Salesforce in the list of available CRM integrations and start the connection.
  </Step>

  <Step title="Authorize Qwoty">
    Sign in to Salesforce and approve the requested access.
  </Step>

  <Step title="Complete the connection">
    Return to Qwoty after authorization.

    ```text theme={null}
    The integration setup starts automatically. You do not need to configure or
    activate a separate synchronization workflow.
    ```
  </Step>
</Steps>

<Success>
  Once the setup is complete, Qwoty can begin synchronizing supported records
  with Salesforce.
</Success>

## Synchronization behavior

<AccordionGroup>
  <Accordion title="Record creation" icon="plus">
    Records that do not already exist in Salesforce are created when the corresponding synchronization event occurs.

    ```text theme={null}
    This applies to supported objects that use `CREATE` or `UPSERT`.
    ```
  </Accordion>

  <Accordion title="Record updates" icon="pen">
    Existing Salesforce opportunities are updated when their associated Qwoty projects change.

    ```text theme={null}
    Products and pricing records may also be updated through the `UPSERT`
    operation.
    ```
  </Accordion>

  <Accordion title="Quote acceptance" icon="circle-check">
    An order is created in Salesforce when the associated quote is accepted in Qwoty.

    ```text theme={null}
    The synchronization creates both the Salesforce **Order** and its related
    **OrderItem** records.
    ```
  </Accordion>

  <Accordion title="Relationships" icon="link">
    Qwoty preserves the logical relationships between synchronized records.

    ```text theme={null}
    For example:

    - A primary contact is linked to its customer account.
    - An opportunity line item is linked to its opportunity.
    - A line-item schedule is linked to its opportunity line item.
    - An order item is linked to its order.
    ```
  </Accordion>
</AccordionGroup>

## Object mapping

| Qwoty object        | Salesforce object           | Operation   |
| ------------------- | --------------------------- | ----------- |
| Customer            | Account                     | Synchronize |
| Primary contact     | Contact                     | Synchronize |
| Project (Quote)     | Opportunity                 | `PATCH`     |
| Line item           | OpportunityLineItem         | `CREATE`    |
| Phase               | OpportunityLineItemSchedule | `CREATE`    |
| Accepted order      | Order                       | `CREATE`    |
| Accepted order line | OrderItem                   | `CREATE`    |
| Product             | Product2                    | `UPSERT`    |
| Product price       | PricebookEntry              | `UPSERT`    |

## Salesforce permissions

The Salesforce user authorizing the connection must be able to access the objects required by the integration.

<AccordionGroup>
  <Accordion title="CRM records" icon="address-book">
    The integration requires access to:

    ```text theme={null}
    - Account
    - Contact
    - Opportunity
    - OpportunityLineItem
    - OpportunityLineItemSchedule
    ```
  </Accordion>

  <Accordion title="Orders" icon="file-invoice">
    To synchronize accepted quotes, the integration requires access to:

    ```text theme={null}
    - Order
    - OrderItem
    ```
  </Accordion>

  <Accordion title="Products and price books" icon="tags">
    To synchronize products and pricing, the integration requires access to:

    ```text theme={null}
    - Product2
    - PricebookEntry
    ```
  </Accordion>
</AccordionGroup>

## Disconnect Salesforce

To stop future synchronization, open the Salesforce integration from your Qwoty workspace settings and disconnect it.

<Warning>
  Disconnecting Salesforce stops future synchronization. It does not automatically delete records that were previously created in Salesforce.
</Warning>

## Troubleshooting

<AccordionGroup>
  <Accordion title="The Salesforce connection cannot be authorized" icon="key">
    Verify that:

    ```text theme={null}
    - You are signing in to the correct Salesforce organization.
    - Your Salesforce user is active.
    - Your user is allowed to authorize connected applications.
    - Your browser is not blocking the authorization window.
    ```
  </Accordion>

  <Accordion title="An opportunity is not updated" icon="briefcase">
    Confirm that the Qwoty project is correctly associated with a Salesforce opportunity.

    ```text theme={null}
    Also verify that the Salesforce user used for the connection has permission
    to update the Opportunity object and the relevant fields.
    ```
  </Accordion>

  <Accordion title="Line items are not created" icon="list">
    Check that:

    ```text theme={null}
    - The corresponding opportunity exists.
    - The product is available in Salesforce.
    - A valid PricebookEntry exists.
    - The connected Salesforce user can create OpportunityLineItem records.
    ```
  </Accordion>

  <Accordion title="Phases are not synchronized" icon="calendar">
    Verify that the related opportunity line item was created successfully.

    ```text theme={null}
    A phase can only be synchronized after its parent
    OpportunityLineItem is available.
    ```
  </Accordion>

  <Accordion title="An accepted quote does not create an order" icon="cart-shopping">
    Confirm that:

    ```text theme={null}
    - The quote has reached the accepted state.
    - The related Salesforce account and opportunity are available.
    - Orders are enabled in the Salesforce organization.
    - The connected user can create Order and OrderItem records.
    ```
  </Accordion>

  <Accordion title="A product is not synchronized" icon="box">
    Verify that the product contains the required information and that the connected user can create or update Product2 and PricebookEntry records.
  </Accordion>
</AccordionGroup>

## Need help?

If the integration remains unavailable after checking the connection and permissions, contact Qwoty support with:

* The affected Qwoty record.
* The corresponding Salesforce record, when available.
* The approximate time of the synchronization attempt.
* A description of the expected result.
