Repository navigation
fix(salesforce): read the mapProperties key the dashboard saves - #5603
Conversation
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
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
mapPropertiesover legacymapProperty. - 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.
…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]>



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 tomapProperty, the key it read before, whenmapPropertiesis absent or null. Salesforce V2 gets the same fix, becauseSALESFORCE_OAUTHandSALESFORCE_OAUTH_SANDBOXuse 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-configschema.json,ui-config.jsonanddb-config.json, for bothsalesforceandsalesforce_oauth. The transform readConfig.mapProperty. config-backend does not rename the key, and rudder-server passesConfigthrough 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:
Company(Lead) andLastName(Lead and Contact) asn/awhen the traits had no usable value, on updates as well as creates.__cto every non-empty Lead or Contact trait outside the ignore list, soCustom_Field__cbecameCustom_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/aover 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 holdsmapProperty.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, nestedaddressorcompany) no longer become Salesforce fields. A create also loses then/adefaults forLastNameandCompany. 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:
Destinations with the switch on, or with neither key set, do not change. One exception: a config that holds both
mapProperties: trueandmapProperty: falsemapped nothing before and maps now. Events that carrymappedToDestinationalready 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?
mapPropertieswins 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 withoutcoerceTypes, boolean schema).How to verify
npx jest -c jest.config.typescript.js component --destination=salesforcepasses 48 of 48.npx jest src/v0/destinations/salesforcepasses 65 of 65.Seven new cases cover:
useContactId;n/adefaults;Each case fails on the code before this fix. On that code, the create case gets
LastName: "n/a"andCompany: "n/a"on a new Lead, and the update case getsCustom_Field__c__c.What is not covered
Configkey the transformer reads with the keys in each destination'sschema.json,db-config.jsonandui-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_conversionsstill readscategoryToContent, which integrations-config removed in feat: remove categoryToContent mapping field for fb_pixel and fb_conversions rudder-integrations-config#1248.custifyhas a dedup branch whose two settings the current dashboard does not expose. The rest look intentional; for example,storeFullEventbelongs 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.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.mdanddocs/businesslogic.mdnow namemapPropertiesand say when__csuffixing 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