# Salesforce Destination Config Reference

<p><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/setup-guide/" >Salesforce</a> is a CRM destination. RudderStack creates and updates Salesforce leads — or other Salesforce objects — from <code>identify</code> events, from its servers.</p>
<p>In a Salesforce destination spec:</p>
<ul>
<li><code>type: salesforce</code></li>
<li><code>definition_version: 1</code></li>
</ul>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">RudderStack has deprecated this destination in favor of <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce-v2/" >Salesforce v2</a>, which Rudder CLI doesn&rsquo;t support.</div>
  </div>
</blockquote>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="sample-configuration">Sample configuration</h2><div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: destination
metadata:
  name: salesforce-prod
spec:
  id: salesforce-prod
  display_name: Salesforce Production
  type: salesforce
  definition_version: 1
  enabled: true
  config:
    user_name: &#34;{{ .SALESFORCE_USER_NAME }}&#34;
    password: &#34;{{ .SALESFORCE_PASSWORD }}&#34;
    initial_access_token: &#34;{{ .SALESFORCE_SECURITY_TOKEN }}&#34;
    sandbox: false

    map_properties: true
    use_contact_id: false

    connection_mode:
      web: cloud
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - marketing</code></pre></div>
</div>
<p>The above example signs in to a production org. <code>initial_access_token</code> holds the user&rsquo;s security token, not an access token — see <a href="#authentication" >Authentication</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="config-keys">Config keys</h2><p><code>config</code> accepts only the keys listed below. The <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#config-key-rules" >shared config key rules</a> cover unknown keys, defaults, and immutability.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">Salesforce accepts only <code>identify</code> events. RudderStack doesn&rsquo;t deliver any other event type to it. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/cloud-mode/" >Send events to Salesforce in cloud mode</a>.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="authentication">Authentication</h3><p>RudderStack signs in as a Salesforce user through the OAuth 2.0 username-password flow, which your org must allow. It sends <code>password</code> with <code>initial_access_token</code> appended, as Salesforce expects for API sign-ins. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/setup-guide/#connection-settings" >Connection settings</a>.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="user_name">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">user_name</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Username of the Salesforce user RudderStack signs in as.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

<div class="rs-ckey" id="password">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">password</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Password of that user.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

<div class="rs-ckey" id="initial_access_token">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">initial_access_token</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  The user&rsquo;s Salesforce security token.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A spec that omits this key fails validation with <code>'initial_access_token' is required</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">Despite its name, this key holds the user&rsquo;s <strong>security token</strong> — the dashboard calls it <strong>Security Token</strong> — not an OAuth access token. Salesforce issues it to the user, and RudderStack appends it to <code>password</code> to sign in.</div>
  </div>
</blockquote>
<p>Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.</p>
</div>

</div>

<div class="rs-ckey" id="sandbox">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">sandbox</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Sign in to a Salesforce sandbox through <code>test.salesforce.com</code> instead of a production org through <code>login.salesforce.com</code>. The dashboard calls it <strong>Sandbox mode</strong>.
</p>

<div class="rs-ckey__extra">
  Developer instances aren&rsquo;t supported — see <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/setup-guide/#does-rudderstack-support-dev-instances-of-salesforce" >Does RudderStack support dev instances of Salesforce?</a>.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="record-mapping">Record mapping</h3><p>Without an external ID naming a Salesforce object, RudderStack looks the lead up by the event&rsquo;s email and updates it, or creates a lead when none matches. An <code>identify</code> event without an email then fails. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/cloud-mode/#update-salesforce-objects" >Update Salesforce objects</a>.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="map_properties">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">map_properties</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>true</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Map traits onto standard Lead and Contact fields, such as <code>firstName</code> to <code>FirstName</code>, and send other traits to custom fields named after them with a <code>__c</code> suffix. Other Salesforce objects receive traits as they are. The dashboard calls it <strong>Map Rudder Properties to Salesforce Properties</strong>.
</p>

<div class="rs-ckey__extra">
  <blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">RudderStack doesn&rsquo;t read this key for this destination, and always maps. Setting <code>map_properties</code> to <code>false</code> has no effect.</div>
  </div>
</blockquote>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/cloud-mode/#update-custom-fields" >Update custom fields</a> and <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/cloud-mode/#supported-mappings" >Supported mappings</a>.</p>
</div>

</div>

<div class="rs-ckey" id="use_contact_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">use_contact_id</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  When the lead matching the event&rsquo;s email has been converted, update the contact it was converted to instead of the lead. The dashboard calls it <strong>Use contactId for converted leads</strong>, and suggests turning it on when your lead and contact field mappings are the same.
</p>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="per-source-keys">Per-source keys</h3><p>Both keys are objects keyed by the local source type — the tokens listed under <a href="#source-types" >Source types</a>. A key naming a source type this destination doesn&rsquo;t support fails validation.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="connection_mode">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">connection_mode</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps each source type you connect to the mode its events reach Salesforce in, using the modes in <a href="#source-types" >Source types</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>An entry is required for each source type you connect — see <a href="#connect-a-source" >Connect a source</a>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">connection_mode:
  web: cloud
  cloud: cloud</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="consent_management">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">consent_management</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Consent provider configuration per source type. The entry shape, accepted providers, and the rules on <code>resolution_strategy</code> and <code>consents</code> are shared across all destination types — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#consent-management" >Consent management</a>.
</p>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="source-types">Source types</h2><p>Salesforce accepts events from these source types in the mentioned connection modes:</p>
<table>
  <thead>
      <tr>
          <th>Source type</th>
          <th>Connection mode</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>android</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>android_kotlin</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios_swift</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>web</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>unity</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>react_native</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>flutter</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cordova</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cloud</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>warehouse</code></td>
          <td><code>cloud</code></td>
      </tr>
  </tbody>
</table>
<p>Every source type is <code>cloud</code> only — events reach Salesforce from RudderStack&rsquo;s servers, never in device mode.</p>

<p><code>warehouse</code> is the token a <a href="https://www.rudderstack.com/docs/sources/reverse-etl/" >Reverse ETL source</a> resolves to. Rudder CLI manages the destination’s <code>warehouse</code> entry — if the destination is connected to a Reverse ETL source, set <code>connection_mode.warehouse: cloud</code> in its spec, or <code>apply</code> removes it.</p>
<p>Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-retl-connections/#supported-destinations" >Supported destinations</a> — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/retl-connections/" >Manage Reverse ETL Connections using Rudder CLI</a>.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">The dashboard additionally offers Salesforce to AMP and Shopify sources. Rudder CLI doesn&rsquo;t manage those connections, so <code>amp</code> and <code>shopify</code> are invalid here.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="connect-a-source">Connect a source</h2><p>An event stream connection to this destination is checked against two rules at <code>validate</code> time.</p>
<p><strong>The source&rsquo;s type must be supported.</strong> A source&rsquo;s type resolves to one of the tokens above before the check — a JavaScript source resolves to <code>web</code>, and webhook and server-side SDK sources resolve to <code>cloud</code>. Every type an event stream source can resolve to is supported here, so this check always passes.</p>
<p><strong>The destination config must carry a <code>connection_mode</code> entry for that source type.</strong> This lives on the destination spec, not on the <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-connections/" >connection spec</a>. Without it:</p>
<div class="rs-code">
  <div class="rs-code__head"><button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-text" data-lang="text">destination &#39;salesforce-prod&#39; config has no &#39;connection_mode&#39; entry for source type &#39;web&#39;</code></pre></div>
</div>
<p>Salesforce needs no additional config keys to connect a source of any type.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="secrets">Secrets</h2><p><code>user_name</code>, <code>password</code>, and <code>initial_access_token</code> are the secret keys. Write each as a <code>{{ .VAR }}</code> reference and supply the value at apply time:</p>
<div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">config:
  user_name: &#34;{{ .SALESFORCE_USER_NAME }}&#34;
  password: &#34;{{ .SALESFORCE_PASSWORD }}&#34;
  initial_access_token: &#34;{{ .SALESFORCE_SECURITY_TOKEN }}&#34;</code></pre></div>
</div>
<div class="rs-code">
  <div class="rs-code__head">bash<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">export RUDDER_SALESFORCE_USER_NAME=&#34;...&#34;
export RUDDER_SALESFORCE_PASSWORD=&#34;...&#34;
export RUDDER_SALESFORCE_SECURITY_TOKEN=&#34;...&#34;
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml</code></pre></div>
</div>
<p>Note that:</p>
<ul>
<li><code>rudder-cli import</code> writes only the secrets the API returns, as <code>{{ .VAR }}</code> references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#secrets" >Secrets</a>.</li>
</ul>
<p>See <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/variable-substitution/" >How to Use Variable Substitution in Rudder CLI</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="changes-by-release">Changes by release</h2>
<p>No changes since this type became available.</p>
<p>For changes across every destination type, see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/changes/" >Destination Type Changes by Release</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="see-more">See more</h2><ul>
<li><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/setup-guide/" >Salesforce Setup Guide</a> for the API user, the username-password flow, and supported editions</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/" >Destination Type Reference for Rudder CLI</a> for the rules shared across destination types</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-destinations/" >Destination YAML Reference</a> for the spec envelope</li>
</ul>

