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

# Person Accounts

> What changes when your org uses Person Accounts: why the record type is mandatory at creation, how first name and last name are written, and how to branch a flow based on the account type.

**Person Accounts** is a Salesforce feature that combines the fields of an Account (`Account`) and those of a Contact (`Contact`) into a single record, to represent an individual person instead of a company.

<img src="https://mintcdn.com/trebleai/n_48dzI5l_tB6XfZ/images/salesforce-person-account-2.png?fit=max&auto=format&n=n_48dzI5l_tB6XfZ&q=85&s=e8bc1fb50e3057dd53982f4f09c7a45d" alt="A Person Account seen in Salesforce" width="320" className="mx-auto" data-path="images/salesforce-person-account-2.png" />

If your org has it enabled, the same `Account` object can hold **two different things**: companies (*Business Accounts*) and people (*Person Accounts*). What separates them is the **record type**.

<Warning>
  **That distinction is the source of almost every problem.** Treble can write to a Person Account perfectly well, but an account becomes a Person Account **at the moment it's created**, and it can't be changed afterwards with a block.
</Warning>

<div class="hr" />

## Before you start: the setup in Salesforce

Person Accounts requires preparation on the Salesforce side that is independent of Treble. If it's incomplete, Treble won't be able to create Person Accounts no matter how well it's configured.

<img src="https://mintcdn.com/trebleai/n_48dzI5l_tB6XfZ/images/salesforce-person-account-1.png?fit=max&auto=format&n=n_48dzI5l_tB6XfZ&q=85&s=b2e885a9e6c7fcd4a23501bbb14e90a8" alt="Person Accounts settings screen in Salesforce Setup" className="mx-auto" width="1649" height="724" data-path="images/salesforce-person-account-1.png" />

Ask your Salesforce administrator to confirm, **for the profile of the user Treble was connected with**:

<Steps>
  <Step title="The Person Account record type is assigned to the profile">
    In *Setup → Profiles →* the profile *→ Record Type Settings → Accounts*, the Person Account record type must be in **Selected Record Types**.
  </Step>

  <Step title="It's set as the default Person Account type">
    In the *Business Account and Person Account Default Record Types* section, the **Person Account Default Record Type** dropdown must have the Person Account type selected.
  </Step>

  <Step title="The default Business Account type is not --Master--">
    The **Business Account Default Record Type** dropdown must have a real value, not `--Master--`.
  </Step>
</Steps>

<Info>
  Remember the general recommendation: connect Treble with a dedicated **service user**. If the user belongs to someone on the team and someone changes their profile, the integration may start creating Business Accounts without anyone noticing.
</Info>

<div class="hr" />

## How to make sure Treble creates Person Accounts

<Warning>
  **Setting `RecordTypeId` in an action block is not enough.** Blocks write **after** the record exists: by the time the block tries to set the type, the account has already been created as a Business Account, or the creation has already failed because of a validation rule.

  <a class="article-link" href="/en/docs/integrations/salesforce/features/record-types"><p>Why this happens</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>
</Warning>

There are two ways to make the account be created correctly:

<AccordionGroup>
  <Accordion title="Option 1: the profile's default type (recommended)">
    This is the Salesforce setup you just reviewed. If the integration user's profile has the Person Account type as its default type, the accounts Treble creates are born as Person Accounts, with no additional configuration.

    It's the most robust solution because it doesn't depend on any flow or any block.
  </Accordion>

  <Accordion title="Option 2: set the record type from the integration">
    Treble can send a fixed `RecordTypeId` **at the moment of creation** of any `Account`.

    Write to your Customer Success Manager with the **18-character Id** of the Person Account record type. You can find it in *Setup → Object Manager → Account → Record Types*, by opening the type and copying the Id from the URL.

    <Warning>
      It's a fixed value for the **entire** `Account` object. If your operation also needs to create companies (Business Accounts) from Treble, this option won't work: every account would end up as a Person Account. Mention it to your Customer Success Manager before requesting it.
    </Warning>
  </Accordion>
</AccordionGroup>

<div class="hr" />

## First name and last name

In a Person Account, the name works differently than in a company account:

| Field | In a Business Account | In a Person Account |
| - | - | - |
| `Name` | It's the company name, and it's written directly | **It can't be written.** Salesforce builds it on its own, combining the first name and last name |
| `FirstName` | Not applicable | The person's first name |
| `LastName` | Not applicable | The last name. Salesforce requires it |

<Check>
  You can write `FirstName` and `LastName` from an action block, just like any other property. The `Name` field will be updated on its own, based on both.
</Check>

<Warning>
  If you try to write directly to `Name` on a Person Account, Salesforce rejects it. Use `FirstName` and `LastName`.
</Warning>

<Info>
  `LastName` is required in Salesforce for a Person Account. If your flow only asks for the first name, consider also asking for the last name, or defining a fallback value with your Customer Success Manager so that the creation doesn't fail when the person doesn't provide it.
</Info>

<div class="hr" />

## Branch the flow based on the account type

When your `Account` object has people and companies mixed together, you often want to treat them differently in the conversation.

The pattern is to read the record type into a variable and connect a **Conditions** block:

<img src="https://mintcdn.com/trebleai/n_48dzI5l_tB6XfZ/images/salesforce-person-account-3.png?fit=max&auto=format&n=n_48dzI5l_tB6XfZ&q=85&s=9e6c7dcd9bf6834f7e519829973b25d3" alt="Read the record type and branch between Person Account and Business Account" className="mx-auto" width="562" height="322" data-path="images/salesforce-person-account-3.png" />

<Steps>
  <Step title="Read the Record Type ID property">
    With the [read block](/en/docs/integrations/salesforce/blocks/crm-variable-assignment), on the `Account` object, save the value into a variable such as `{{record_type}}`.
  </Step>

  <Step title="Connect a Conditions block">
    Create one condition for *Person Account* and another for *Business Account*, and leave the default case for everything else (for example, when the person doesn't exist yet and the variable arrives empty).
  </Step>
</Steps>

<Tip>
  Don't forget the *In all other cases* path. For a new contact that doesn't exist in Salesforce yet, the variable arrives empty and doesn't fall into either of the two conditions.
</Tip>

You can also use the record type as a **custom hierarchy** in an action block, to specifically target that person's Person Account-type account:

<img src="https://mintcdn.com/trebleai/n_48dzI5l_tB6XfZ/images/salesforce-person-account-4.png?fit=max&auto=format&n=n_48dzI5l_tB6XfZ&q=85&s=9a0835297ebb920ede0e532a0720ccdb" alt="Action block with hierarchy by record type" width="280" className="mx-auto" data-path="images/salesforce-person-account-4.png" />

<div class="hr" />

## Common issues

<AccordionGroup>
  <Accordion title="Treble creates company accounts instead of Person Accounts">
    The integration user's profile doesn't have the Person Account type as its default type. Review the Salesforce setup section at the beginning of this page.

    Accounts that were already created incorrectly don't fix themselves: they need to be converted in Salesforce.
  </Accordion>

  <Accordion title="Creation fails with a required field error that doesn't appear on the form">
    It's almost always a validation rule tied to the record type. Because the account is born with the wrong type, rules that don't belong to it are applied.

    Confirm the record type first; it's very likely that several different errors are resolved with that single change.
  </Accordion>

  <Accordion title="Salesforce rejects writing to Name">
    In a Person Account, `Name` is a calculated field. Write `FirstName` and `LastName` instead.
  </Accordion>

  <Accordion title="I don't see FirstName or LastName in the property list">
    Run the [object sync](/en/docs/integrations/salesforce/object-sync). If they still don't appear after syncing, write to your Customer Success Manager indicating that it's an integration with Person Accounts.
  </Accordion>

  <Accordion title="Duplicate accounts are created for the same person">
    Check the integration's **phone lookup field**: it has to be the same field where the numbers of your existing Person Accounts are stored. If it points to another field, Treble doesn't find them and creates a new one every time.

    Also check that no block has "Create a new object" enabled on `Account`.
  </Accordion>
</AccordionGroup>

<div class="hr" />

## Next steps

<CardGroup cols={2}>
  <Card title="Record types" icon="layer-group" href="/en/docs/integrations/salesforce/features/record-types">
    The mechanism behind almost all of these problems.
  </Card>

  <Card title="Advanced settings" icon="sliders" href="/en/docs/integrations/salesforce/features/advanced-settings">
    What can be set at the moment of creation.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.