Skip to content

fix(salesforce): read the mapProperties key the dashboard saves - #5603

Merged
lvrach merged 3 commits into
developfrom
fix/int-7188-salesforce-map-properties-key
Sep 23, 2026
Merged

lvrach merged 3 commits into
developfrom
fix/int-7188-salesforce-map-properties-key

Conversation

@lvrach

@lvrach lvrach commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What are the changes introduced in this PR?

The Salesforce transform now reads the mapping switch under the key the dashboard saves, mapProperties. It falls back to mapProperty, the key it read before, when mapProperties is absent or null. Salesforce V2 gets the same fix, because SALESFORCE_OAUTH and SALESFORCE_OAUTH_SANDBOX use this transform.

What is the related Linear task?

Resolves INT-7188

Please explain the objectives of your changes below

The dashboard saves "Map Rudder Properties to Salesforce Properties" as mapProperties. That is the name in rudder-integrations-config schema.json, ui-config.json and db-config.json, for both salesforce and salesforce_oauth. The transform read Config.mapProperty. config-backend does not rename the key, and rudder-server passes Config through unchanged. So for a destination saved from the dashboard, the value was undefined, and the transform defaulted to mapping on.

With the switch off, a destination still mapped:

  • It wrote Company (Lead) and LastName (Lead and Contact) as n/a when the traits had no usable value, on updates as well as creates.
  • It added __c to every non-empty Lead or Contact trait outside the ignore list, so Custom_Field__c became Custom_Field__c__c, and Salesforce rejected the record.

The only existing mapping-off test used mapProperty: false, so the suite never saw the dashboard's key.

This blocks ACT2-769. RevOps set up a Salesforce V2 destination for Lookout signals with mapping off, and that connection cannot go live until this ships.

How we found it: Lookout sends only an email, ids and dates to Salesforce. With mapping on, each update would write n/a over real names. So RevOps created a separate destination with the switch off. Before we connected it, we traced the switch from the dashboard to the transform and found the key mismatch. A fleet query then showed that no saved Salesforce destination config holds mapProperty.

Internal write-up with the diagram, payloads and customer impact (RudderStack sign-in required): https://rudder-office.fly.dev/docs/int-7188-salesforce-mapping-switch.html

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Yes. Lead and Contact identifies on a destination saved with the switch off stop mapping for the first time, and their traits go to Salesforce as they are.

That is what those customers chose, but some may depend on mapping without knowing it. Traits in RudderStack shape (email, firstName, nested address or company) no longer become Salesforce fields. A create also loses the n/a defaults for LastName and Company. Salesforce rejects such records. The response handler aborts field-validation 400s (only a locked row is retried), so the pipeline drops those events.

Some customer destinations have the switch off. The count, traffic and failure analysis are in the internal write-up linked above.

Before the deploy:

  • Sample the recent payloads of those destinations for RudderStack-shaped traits.
  • Tell the owners of any affected destination before the release.

Destinations with the switch on, or with neither key set, do not change. One exception: a config that holds both mapProperties: true and mapProperty: false mapped nothing before and maps now. Events that carry mappedToDestination already skip mapping.

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

mapProperties wins when both keys are set. A string "false" would still count as on. That is unchanged from before, and config-backend rejects it when schema validation is enabled (AJV without coerceTypes, boolean schema).

How to verify

npx jest -c jest.config.typescript.js component --destination=salesforce passes 48 of 48. npx jest src/v0/destinations/salesforce passes 65 of 65.

Seven new cases cover:

  • mapping off on the legacy destination and on Salesforce V2;
  • both precedence directions when both keys are set;
  • a converted Lead redirected to its Contact with useContactId;
  • a new Lead created with mapping off, which gets no n/a defaults;
  • the router path.

Each case fails on the code before this fix. On that code, the create case gets LastName: "n/a" and Company: "n/a" on a new Lead, and the update case gets Custom_Field__c__c.

What is not covered

  • A guard against the same drift in other destinations. I compared every Config key the transformer reads with the keys in each destination's schema.json, db-config.json and ui-config.json, for the 160 v0 destinations that have a schema. Salesforce is the only one where a mismatch disables a setting users can change. Two reads look like dead code. facebook_conversions still reads categoryToContent, which integrations-config removed in feat: remove categoryToContent mapping field for fb_pixel and fb_conversions rudder-integrations-config#1248. custify has a dedup branch whose two settings the current dashboard does not expose. The rest look intentional; for example, storeFullEvent belongs to rudder-server's warehouse options, not to the dashboard. A CI check that runs this comparison could detect similar mismatches. It needs integrations-config at test time, so it belongs in its own ticket.
  • The default does not change. Mapping stays on when neither key is set.

Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced. The behaviour change above is intended, but it can break destinations that depend on mapping.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change? README.md and docs/businesslogic.md now name mapProperties and say when __c suffixing and replay safety apply.

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format? Component cases, built from a small helper in the existing fixtures.

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

🤖 Generated with Claude Code

The dashboard saves the "Map Rudder Properties to Salesforce Properties"
switch as mapProperties. The transform read mapProperty, which is always
undefined for dashboard configs, so mapping stayed on even with the switch
off. Destinations then wrote LastName and Company as n/a and appended __c
to every trait key. The transform now reads mapProperties and falls back to
mapProperty for configs written through the API with the old name.

Verify: the new processor case with mapProperties: false passes. On the
old code it fails with LastName "n/a", Company "n/a" and
Custom_Field__c__c.

Resolves INT-7188

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
Replaces the copied processor case with six focused ones built from a
small helper: mapping off on the legacy destination and on Salesforce V2,
both precedence directions when both keys are set, a converted Lead
redirected to its Contact, and a new Lead created without the n/a
defaults. Adds one router case, because the router shares
processIdentify. Each new case fails on the code before the fix. The docs
now name mapProperties and say when __c suffixing and replay safety apply.

Verify: the Salesforce component suite passes 48 of 48 and the unit suite
65 of 65.

Refs INT-7188

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
The create case now sends only LeadSource, a field both paths keep, so on
the old code it fails on the injected LastName and Company n/a and nothing
else. The Lead helper drops an unused context parameter and is named for
the fixed Lead external id it adds. The README states the real __c rule
(every non-empty trait outside the ignore list) and that a replay after a
change to mapProperties may build a different payload.

Verify: the Salesforce component suite passes 48 of 48.

Refs INT-7188

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@lvrach
lvrach requested review from a team as code owners September 22, 2026 21:23
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e7d31fc0-b136-40e9-b51a-3fa8cf244cc2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.01%. Comparing base (dfdd95f) to head (d4c80ca).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5603   +/-   ##
========================================
  Coverage    93.01%   93.01%           
========================================
  Files          729      729           
  Lines        39437    39438    +1     
  Branches      9198     9198           
========================================
+ Hits         36682    36685    +3     
+ Misses        2556     2554    -2     
  Partials       199      199           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation correctly preserves defaults and legacy fallback behavior with comprehensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Salesforce transforms to honor the dashboard’s mapProperties setting while preserving legacy fallback behavior.

Changes:

  • Prioritizes mapProperties over legacy mapProperty.
  • Adds processor/router coverage for mapping, precedence, Salesforce V2, Lead creation, and converted Contacts.
  • Updates Salesforce documentation.
File Description
src/​v0/​destinations/​salesforce/​transform.js Reads the canonical mapping configuration key.
src/​v0/​destinations/​salesforce/​README.md Documents mapping and replay behavior.
src/​v0/​destinations/​salesforce/​docs/​businesslogic.md Updates configuration-key references.
test/​integrations/​destinations/​salesforce/​processor/​data.ts Adds mapping-switch processor cases.
test/​integrations/​destinations/​salesforce/​router/​data.ts Adds router-path regression coverage.
test/​integrations/​destinations/​salesforce/​network.ts Adds Lead lookup mocks for new scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lvrach
lvrach merged commit 75260c6 into develop Sep 23, 2026
41 checks passed
@lvrach
lvrach deleted the fix/int-7188-salesforce-map-properties-key branch September 23, 2026 14:17
shekhar-rudder added a commit that referenced this pull request Sep 24, 2026
…asured

Merging develop showed two things the branch could not see from its own base.

EVERFLOW landed on develop after the branch was cut, so CI derived 200
destinations against a manifest holding 199. It derives
`params.verification_token` from its declared `secretKeys` - the configured
source, unrelated to this change.

SALESFORCE derived `null` rather than `["headers.Authorization"]`, which the
branch's own base could not reproduce because develop carries two Salesforce
transform fixes (#5603, #5604) that change how it responds to a decoy. With the
bag measured first, SALESFORCE turns out to destabilise under it: the bag moves
`endpoint` and `headers.Authorization` on the cases that hold, and a later case
collapses the transform entirely, which discarded every measured location and
masked the destination wholesale.

So the rescue is now skipped only when the bag destabilised *and* was never
compared cleanly in any case. That is the case the guard was added for - a
rescue result says nothing about where the bag's token went, so publishing it
would be a positive claim built on unrelated evidence. When the bag was compared
cleanly somewhere, its locations came from the same corroborated diff every
other path comes from, and discarding them to punish an unrelated case trades a
measured answer for a blunter one.

200 destinations: 118 with derived paths, 82 with nothing to mask, 0 fail-closed.

Fixture-quality gaps that bound this - dual-use credential values, paths resting
on a single case, a declared credential no fixture populates - are tracked
separately in INT-7221, which is fixture-only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants