Skip to content

[NIFI-13869] - Enhance QuerySalesforceObject Processor to Support Querying Deleted Records#9434

Closed
Nicolae93 wants to merge 3 commits intoapache:mainfrom
Nicolae93:origin/NIFI-13869
Closed

[NIFI-13869] - Enhance QuerySalesforceObject Processor to Support Querying Deleted Records#9434
Nicolae93 wants to merge 3 commits intoapache:mainfrom
Nicolae93:origin/NIFI-13869

Conversation

@Nicolae93
Copy link
Copy Markdown
Contributor

Summary

NIFI-13869

Enhance the QuerySalesforceObject processor to support querying deleted records (soft-deletes) from Salesforce. This enhancement introduces a new boolean property Include Deleted Records that allows users to include deleted records in their queries. When enabled, the processor automatically includes the IsDeleted field in the SELECT clause and utilizes the queryAll Salesforce API endpoint to retrieve both active and deleted records. This functionality is essential for scenarios requiring audit trails, compliance tracking, and monitoring record deletions.

Key Changes:

  • New Property Added:

    • Include Deleted Records (Boolean): Enables the inclusion of deleted records in Salesforce queries.
  • Query Modification:

    • When Include Deleted Records is set to true, the IsDeleted field is added to the SELECT statement if not already present.
    • The processor switches from using the /query endpoint to the /queryAll endpoint to fetch both active and deleted records.
  • SalesforceRestClient Updates:

    • Added a new method queryAll(String query) to support the /queryAll API endpoint.
  • Backward Compatibility:

    • The default behavior remains unchanged (Include Deleted Records is false), ensuring existing workflows are not disrupted unless explicitly enabled.
  • State Management:

    • Updated state reset logic to account for changes in the Include Deleted Records property, ensuring consistent behavior upon property modifications.
  • Documentation:

    • Updated processor annotations and descriptions to reflect the new functionality and guide users on utilizing the Include Deleted Records property.

This enhancement allows users to effectively track and manage deleted records within their Salesforce integrations, aligning with audit and compliance requirements without affecting existing data retrieval processes.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-13869
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-13869

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 21

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files
  • Processor annotations and descriptions updated to include new property and functionality
  • User-facing documentation (if applicable) updated to guide on using Include Deleted Records

Testing

  • Unit tests added to cover new functionality
  • All existing tests pass successfully
  • Backward compatibility confirmed by ensuring default behavior excludes deleted records

Code Review

  • Code adheres to Apache NiFi coding standards and guidelines
  • Code reviewed for readability, maintainability, and performance considerations
  • No warnings or errors reported by static analysis tools

…ng Deleted Records

- Added a new boolean property `Include Deleted Records` to allow users to include deleted (soft-deleted) records in Salesforce queries.
- Modified the query construction to include the `IsDeleted` field and use the `queryAll` API endpoint when `Include Deleted Records` is enabled.
- Updated `SalesforceRestClient` to support the `queryAll` API by adding a new `queryAll` method.
- Ensured backward compatibility by defaulting `Include Deleted Records` to `false`, maintaining existing behavior unless explicitly enabled.
- Updated processor documentation and annotations to reflect the new functionality.
- Adjusted state management to reset state when `Include Deleted Records` property is modified.
…ng Deleted Records

- Added a new boolean property `Include Deleted Records` to allow users to include deleted (soft-deleted) records in Salesforce queries.
- Modified the query construction to include the `IsDeleted` field and use the `queryAll` API endpoint when `Include Deleted Records` is enabled.
- Updated `SalesforceRestClient` to support the `queryAll` API by adding a new `queryAll` method.
- Ensured backward compatibility by defaulting `Include Deleted Records` to `false`, maintaining existing behavior unless explicitly enabled.
- Updated processor documentation and annotations to reflect the new functionality.
- Adjusted state management to reset state when `Include Deleted Records` property is modified.
Copy link
Copy Markdown
Contributor

@pvillard31 pvillard31 left a comment

Choose a reason for hiding this comment

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

Thanks for this improvement @Nicolae93 - the changes look good to me. Thanks for putting together a very well explained and described pull request. If you want this to also land in the 1.x branch, you'll need to file a specific PR against the support branch.

@asfgit asfgit closed this in 3521905 Oct 22, 2024
@Nicolae93
Copy link
Copy Markdown
Contributor Author

Hi @pvillard31! I'm glad to hear that my first contribution was well-received! I've submitted a PR for the 1.x version against the support branch apache:support/nifi-1.x using the same JIRA issue. Is that ok?

kravii pushed a commit to acceldata-io/nifi that referenced this pull request Sep 3, 2025
…ng Deleted Records

- Added a new boolean property `Include Deleted Records` to allow users to include deleted (soft-deleted) records in Salesforce queries.
- Modified the query construction to include the `IsDeleted` field and use the `queryAll` API endpoint when `Include Deleted Records` is enabled.
- Updated `SalesforceRestClient` to support the `queryAll` API by adding a new `queryAll` method.
- Ensured backward compatibility by defaulting `Include Deleted Records` to `false`, maintaining existing behavior unless explicitly enabled.
- Updated processor documentation and annotations to reflect the new functionality.
- Adjusted state management to reset state when `Include Deleted Records` property is modified.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#9434.

(cherry picked from commit 3521905)
shubhluck pushed a commit to acceldata-io/nifi that referenced this pull request Sep 9, 2025
…ng Deleted Records

- Added a new boolean property `Include Deleted Records` to allow users to include deleted (soft-deleted) records in Salesforce queries.
- Modified the query construction to include the `IsDeleted` field and use the `queryAll` API endpoint when `Include Deleted Records` is enabled.
- Updated `SalesforceRestClient` to support the `queryAll` API by adding a new `queryAll` method.
- Ensured backward compatibility by defaulting `Include Deleted Records` to `false`, maintaining existing behavior unless explicitly enabled.
- Updated processor documentation and annotations to reflect the new functionality.
- Adjusted state management to reset state when `Include Deleted Records` property is modified.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#9434.

(cherry picked from commit 3521905)
kravii pushed a commit to acceldata-io/nifi that referenced this pull request Dec 15, 2025
…ng Deleted Records

- Added a new boolean property `Include Deleted Records` to allow users to include deleted (soft-deleted) records in Salesforce queries.
- Modified the query construction to include the `IsDeleted` field and use the `queryAll` API endpoint when `Include Deleted Records` is enabled.
- Updated `SalesforceRestClient` to support the `queryAll` API by adding a new `queryAll` method.
- Ensured backward compatibility by defaulting `Include Deleted Records` to `false`, maintaining existing behavior unless explicitly enabled.
- Updated processor documentation and annotations to reflect the new functionality.
- Adjusted state management to reset state when `Include Deleted Records` property is modified.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#9434.

(cherry picked from commit 3521905)
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.

2 participants