# Salesforce

### Sections in this article

* [Overview](#overview')
* [When to Use the Salesforce Node](#when-to-use-the-salesforce-node)
* [Before You Begin](#before-you-begin)
* [Field Setup & Workflow Configuration](#field-setup-and-workflow-configuration)
  * [Required Fields](#required-fields)
  * [Built-In Fields](#built-in-fields)
* [Syncing Scores and Account Overview](#syncing-scores-and-account-overview)
* [Custom Fields](#custom-fields)
* [Field Management](#field-management)
* [Troubleshooting](#troubleshooting)

### Overview

HockeyStack Workflows let you automatically turn AI insights into action across sales, marketing, and customer success. This guide explains how to set up the Salesforce integration, configure required fields, and begin syncing data from HockeyStack to your Salesforce CRM.

#### What This Integration Does

* Syncs HockeyStack intent scores to Salesforce Account records
* Provides AI-generated account journey summaries and score reasoning
* Enables automatic contact creation and enrichment
* Tracks account engagement trends (Surging, Heating, Cooling, etc.)

### When to Use the Salesforce Node

Use this destination when you want to:

* **Push account intelligence** to Salesforce from your HockeyStack workflows
* **Keep your CRM current** with new discoveries from Contact Discovery or AI nodes
* **Automate record creation** for new companies or contacts based on workflow triggers
* **Enrich existing records** with custom fields and AI-generated insights
* **Sync scoring data** to empower your sales team with real-time intelligence

### Before You Begin

**Prerequisites:**&#x20;

* **Salesforce** integration is connected to HockeyStack
  * See our [salesforce](https://docs.hockeystack.com/integrations/crms/salesforce "mention")documentation for more details
  * Select which connected Salesforce account this workflow should sync with:
    * **Production Account**: Syncs to your main Salesforce org
    * **Sandbox Account**: Syncs to your Salesforce sandbox environment (useful for testing workflows)
* **Required fields created** on your Salesforce Account Object&#x20;
  * See [Required Fields ](#required-fields)below
* **Proper permissions** granted to the HockeyStack integration user
  * See [salesforce-permissions](https://docs.hockeystack.com/account-intelligence/getting-started/salesforce/salesforce-permissions "mention") for more information

### Field Setup & Workflow Configuration

#### Required Fields

To sync HockeyStack scores and AI insights, create these fields on your Salesforce **Account** object:

<table><thead><tr><th width="105.9921875">Field Purpose</th><th width="291.44140625">API Name</th><th width="265.46875">API Name to Paste in Salesforce</th><th width="97.44140625">Field Type</th><th>Required?</th></tr></thead><tbody><tr><td>Intent Score</td><td><code>HS_Intent_Score__c</code></td><td><code>HS_Intent_Score</code></td><td>Number</td><td>Yes</td></tr><tr><td>Score Status</td><td><code>HS_Intent_Score_Status__c</code></td><td><code>HS_Intent_Score_Status</code></td><td>Picklist</td><td>Yes</td></tr><tr><td>Score Reasoning</td><td><code>HS_Score_Reasoning__c</code></td><td><code>HS_Score_Reasoning</code></td><td>Long Text Area</td><td>Yes</td></tr><tr><td>Company Journey</td><td><code>HS_Company_Journey__c</code></td><td><code>HS_Company_Journey</code></td><td>Long Text Area</td><td>Yes</td></tr><tr><td>Last Scored At</td><td><code>HS_hockeystack_last_scored_at__c</code></td><td><code>HS_hockeystack_last_scored_at</code></td><td>DateTime</td><td>Yes</td></tr></tbody></table>

**Note:** When creating these fields in Salesforce, enter the API name **without** the `__c` suffix. Salesforce adds this automatically.

For example, enter `HS_Intent_Score` and Salesforce will create `HS_Intent_Score__c`.

**Picklist Values for `HS_Intent_Score_Status__c`**

Enter these values exactly as shown (one per line):

* New
* Surging
* Heating
* Cooling
* Neutral

### Objects to Sync

> **Note**: You can enable any combination of these options. For example, you might choose to only create companies but update both create and update contacts.

Configure what types of operations the node should perform:

| Operation                | Description                                                            |
| ------------------------ | ---------------------------------------------------------------------- |
| **Create Accounts**      | Adds a new account to Salesforce if it doesn't already exist.          |
| **Update Accounts**      | Updates existing account in Salesforce using the matched record.       |
| **Assign Account Owner** | Select a User to assign as owner to the Account.                       |
| **Create Contacts**      | Adds a new contact to Salesforce if it doesn’t already exist.          |
| **Update Contacts**      | Updates existing Salesforce contacts with enriched or discovered data. |
| **Assign Contact Owner** | Select a User to assign as owner to the contacts.                      |

### Data Requirements

* **Companies**: Requires a valid company domain to be processed
* **Contacts**: Requires a valid email address to be processed (contacts without valid emails are automatically filtered out)

### Built-In Fields

{% hint style="warning" %}
**Important:** When creating the fields listed below in Salesforce, **do not manually add the “\_\_c” suffix**. Salesforce automatically appends this suffix to all custom fields when they are created.

If you are manually creating the `HS_Workflows` field, enter the API name as `HS_Workflows` (NOT `HS_Workflows__c`). Salesforce will automatically make it `HS_Workflows__c`.
{% endhint %}

If the HockeyStack integration user was granted permission to create and modify for Account and Contact objects, the following fields are automatically created and managed by HockeyStack for both objects:

<table><thead><tr><th>Field Label</th><th width="271.66796875">Field API Name </th><th width="221.80859375">Description</th><th>SFDC Type</th></tr></thead><tbody><tr><td>HS Workflows</td><td>HS_Workflows__c</td><td>Comma separated list of names of workflows that have processed this record</td><td>Long Text</td></tr><tr><td>HS Workflows IDs</td><td>HS_Workflows_Ids__c</td><td>Comma separated list of IDs of workflows that have processed this record</td><td>Long Text</td></tr><tr><td>HS Workflows Created Date</td><td>HS_Workflows_Created_Date__c</td><td>Date when first created by a workflow</td><td>DateTime</td></tr><tr><td>HS Workflows Last Updated Date</td><td>HS_Workflows_Updated_Date__c</td><td>Last updated date by any workflow</td><td>DateTime</td></tr><tr><td>Created by HockeyStack</td><td>HS_Created_By_HockeyStack__c</td><td>Checkbox indicating if record was created by HockeyStack</td><td>Boolean</td></tr></tbody></table>

### Syncing Scores and Account Overview

Certain fields must exist in the **Account** object on Salesforce **with the exact names listed below** to enable syncing of **Score**, **Score Status**, **Score Reasoning**, and **Company Overview**. These field names are **preconfigured** in our system to ensure a seamless and accurate data sync.&#x20;

There are two ways to create the fields:

1. If the HockeyStack integration user has [permissions](https://docs.hockeystack.com/account-intelligence/getting-started/salesforce/salesforce-permissions) to **create** custom fields on the **Account** object, the fields can be automatically created in your Salesforce instance.
2. If you prefer not to grant the permissions above to HockeyStack, you can manually create the fields in Salesforce. Once created, HockeyStack only needs **Write** access to update their values.

<table><thead><tr><th>Field Label</th><th width="287.8125">Field API Name</th><th width="205.99609375">Description</th><th>SFDC Type</th></tr></thead><tbody><tr><td>HS Intent Score</td><td>HS_Intent_Score__c</td><td>Intent score calculated by HockeyStack</td><td>Number</td></tr><tr><td>HS Intent Score Status</td><td>HS_Intent_Score_Status__c</td><td>The trend of the score.  The possible values are: New, Neutral, Heating, Surging, Cooling</td><td>Picklist</td></tr><tr><td>HS Score Reasoning</td><td>HS_Score_Reasoning__c</td><td>Explanation of how the intent score was calculated</td><td>Long Text</td></tr><tr><td>HS Company Journey </td><td>HS_Company_Journey__c</td><td>Summary of the company's journey and touchpoints</td><td>Long Text</td></tr><tr><td>HS Last Scored At</td><td>HS_hockeystack_last_scored_at__c</td><td>Timestamp of the last score calculated by HockeyStack</td><td>DateTime</td></tr></tbody></table>

Once these fields have been created, follow the steps below to sync scores to Salesforce:

1. Go to Workflows
2. Use Account View in Source Node
3. Add Salesforce Node
4. Select **Account** as the object to sync
5. Select **Update** Accounts
6. Select **HockeyStack Score** in **Account Custom Fields**
7. Select **Dynamic**
8. Select **HS\_Intent\_Score\_\_c** in **Property**
9. Save/enable the Workflow

### Custom Fields

#### 1. Custom **Fields Selection**

This is where you select which CRM field you want to write to. You can either create or search to find an existing Salesforce field (e.g., `Account Type`, `Billing Country`, or your custom fields like `HockeyStack Score`).

#### 2. **Selected Field Summary**

Once you select a field, you’ll see detailed information:

* **Field Label**: The human-readable name (e.g., *HockeyStack Score*).
* **Field Name**: The internal API name used by Salesforce (e.g., `HS_hockeystack_score__c`).
* **Field Type**: The data type of the field in Salesforce (e.g., `string`, `boolean`, etc).
* **Value Type**:
  * `Static`: You define a fixed value that is always sent (e.g., always "Marketing Qualified").
  * `Dynamic`: The value comes from a property in HockeyStack (e.g., the actual intent score or account stage at the time of sync).

#### **3.1 Value (When Static is Selected)**

* When **Static** is chosen, this input lets you write anything that will be synced into the selected CRM field.
* For example, you might map value `true` to a property like `Is Marketing Qualified`.

#### **3.2. Property (When Dynamic is Selected)**

* When **Dynamic** is chosen, this dropdown lets you select a HockeyStack property to sync into the selected CRM field.
* For example, you might map `HockeyStack Score` to a property like `Intent Score`.

### Field Management

If the HockeyStack integration user has permission to create and modify **Account** and **Contact** objects, and to create **custom fields**, managing fields becomes much easier.

* **Automatic Creation**: You can define and create Salesforce custom fields through the Salesforce node.&#x20;
* **Permission Management**: Field permissions are automatically set for standard profiles (System Administrator, Standard User) and your HockeyStack-connected user profile.

### Troubleshooting

**Fields Not Appearing**: If custom fields don't appear in Salesforce, check that:

* Your user has permission to create custom fields
* You haven't exceeded your org's custom field limits

**Permission Errors**: Ensure your Salesforce integration user has:

* Create and modify permissions for Account and Contact objects
* Permission to create custom fields
* Permission to read and write the following fields:
  * Contact
    * AccountId
    * FirstName
    * LastName
    * Email
    * OwnerId
  * Account
    * Name
    * Website
    * OwnerId
* Access to the profiles and permission sets being updated
