Skip to content

Conversation

choeqq
Copy link
Contributor

@choeqq choeqq commented Oct 7, 2025

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:

  1. Create a Contact with text__c custom field empty (or not set)
  2. Update the Contact and add a value to text__c (e.g., "text input")
  3. ❌ The webhook was not processed even though the field changed

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:

  • body.New.text__c = "text input" (defined)
  • body.Old.text__c = undefined (not present in Old object)

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:

  • A field goes from empty/non-existent → has value (undefined → "text input")
  • A field goes from one value → another value ("old text" → "new text")
  • A field goes from value → empty ("text" → undefined)

Changes Made

File: components/salesforce_rest_api/sources/common/common-updated-record.mjs

Removed one line from the getChangedFields() method (line 118):

  • && oldValue !== undefined

Summary by CodeRabbit

  • Bug Fixes

    • Change detection now treats fields with a defined new value as updated even if the prior value is missing, improving event emission and reducing missed updates across webhook and timer flows.
  • Chores

    • Package and source component versions bumped to new patch releases for consistency.
Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 7, 2025 8:19am
@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Oct 7, 2025
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

getChangedFields 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

Cohort / File(s) Summary of modifications
Change detection logic
components/salesforce_rest_api/sources/common/common-updated-record.mjs
Relaxed condition in getChangedFields: no longer requires oldValue to be defined; compares JSON.stringify(value) to JSON.stringify(oldValue). Fields with defined new values and undefined old values now count as changed, affecting processWebhookEvent and processTimerEvent flows that rely on changedFields.
Package metadata bumps
components/salesforce_rest_api/package.json
Package version bumped from 1.9.1 to 1.9.2.
Source version increments
components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs, components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs, components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs, components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs, components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs, components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs, components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs, components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs, components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs, components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs
Incremented version fields in multiple source modules (e.g., from 0.0.40.0.5, 0.1.100.1.11, 0.2.40.2.5, etc.). No behavioral or logic changes in these files beyond metadata updates.

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 
Loading
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 
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit in code pads, I sniff the field,
When new is set and old's not revealed,
I clap my paws — a change I see,
Emit the hops of metadata, whee!
Carrot commits — a tiny jubilee 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the main change by indicating that the Salesforce Record Updated source now detects changes from empty to populated fields, matching the single-line code modification described in the PR and avoiding unnecessary detail or noise.
Description Check ✅ Passed The description follows the repository template by including the required WHY section and provides a clear scenario, root cause analysis, solution description, and specific file change, offering all critical context for reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bc68cd and 72c42a6.

📒 Files selected for processing (11)
  • components/salesforce_rest_api/package.json (1 hunks)
  • components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (8)
  • components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs
  • components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs
  • components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs
  • components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs
  • components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs
  • components/salesforce_rest_api/package.json
  • components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs
  • components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs
⏰ 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)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs (1)

10-10: Version bump aligns with package release.

The version bump is appropriate as part of the package-wide release (components/salesforce_rest_api from 1.9.1 to 1.9.2), maintaining consistency across all Salesforce REST API sources.

components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs (1)

10-10: Version bump reflects the underlying fix.

The version increment is appropriate and necessary. This source imports from common-updated-record.mjs, which now correctly detects field changes when a field transitions from empty/non-existent to populated, addressing the issue described in the PR.

components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs (1)

10-10: Approve version bumps for all update-instant sources

All four components importing common-updated-record.mjs have been updated to the new version.


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 and usage tips.

@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Collaborator

@GTFalcao GTFalcao left a 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!

@GTFalcao GTFalcao moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
4 participants