-
Couldn't load subscription status.
- Fork 5.5k
[FIX] - Salesforce Record Updated Source - Detect Changes from Empty to Populated Fields #18662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] - Salesforce Record Updated Source - Detect Changes from Empty to Populated Fields #18662
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
WalkthroughgetChangedFields was modified to consider a field changed when its new value is defined even if the old value is undefined (comparison uses JSON.stringify). This alters which fields appear in changedFields and affects downstream relevance checks and emitted metadata in webhook and timer processing. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor SF as Salesforce
participant SRC as Source Handler
participant CFD as getChangedFields
participant EB as Event Emitter
rect rgb(230,245,255)
note right of CFD: Updated logic: fields with defined new value and undefined old value count as changed
end
SF->>SRC: Webhook event (record payload)
SRC->>CFD: Compute changedFields(new vs old)
CFD-->>SRC: changedFields
alt changedFields not empty
SRC->>EB: Emit event with metadata
else
SRC-->>SF: No emission
end
sequenceDiagram
autonumber
participant TIMER as Timer
participant SRC as Source Poller
participant CFD as getChangedFields
participant EB as Event Emitter
TIMER->>SRC: Trigger poll
SRC->>CFD: Compute changedFields(new vs old)
CFD-->>SRC: changedFields
alt changedFields not empty
SRC->>EB: Emit event with metadata
else
SRC-->>TIMER: No-op
end
note over SRC,CFD: Same updated comparison behavior applies
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (11)
✅ Files skipped from review due to trivial changes (8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (3)
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 |
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @choeqq , thanks for your contribution, this makes sense. LGTM!
|
Hi everyone, all test cases are passed! Ready for release! |
WHY
The Salesforce "Record Updated" source was not detecting field changes when a field went from empty/non-existent to having a value.
Example scenario:
Root Cause
The getChangedFields() method in common-updated-record.mjs (line 118) was checking:
value !== undefined && oldValue !== undefined && JSON.stringify(value) !== JSON.stringify(oldValue)
When a field goes from non-existent → populated:
The condition oldValue !== undefined would be false, causing the field change to be ignored.
Solution
Removed the oldValue !== undefined check, so the method now detects changes when:
Changes Made
File: components/salesforce_rest_api/sources/common/common-updated-record.mjs
Removed one line from the getChangedFields() method (line 118):
Summary by CodeRabbit
Bug Fixes
Chores