@W-22098350 Add Apex v67.0 Secure by Default support to buyer group services#92
Merged
kushalkrip merged 2 commits intoApr 24, 2026
Merged
Conversation
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Aditya Srivastav <a***@A***.i***.s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated. |
- Add WITH SYSTEM_MODE to all SOQL queries in BuyerGroupEvaluationServiceSample to ensure queries work in v67.0+ where USER_MODE becomes the default - Add security documentation to both buyer group service implementations explaining WITHOUT SHARING and WITH SYSTEM_MODE usage - Changes are backward compatible with v64-v66 (WITH SYSTEM_MODE ignored) - Ensures guest users can retrieve buyer groups in all API versions Files changed: - BuyerGroupEvaluationServiceSample.cls: 4 queries + security docs - BuyerGroupShareableURLSample.cls: security docs only (no queries) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
e6e64a0 to
f1f148a
Compare
- Add link to Salesforce Summer '26 (v67.0) release notes - Rewrite security comments to be educational rather than prescriptive - Explain v67.0 requirements and why this sample uses specific patterns - Remove "when adapting" guidance to let developers make their own decisions The documentation now helps developers understand the v67.0 context and the reasoning behind the security choices in these samples. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
saisubburlj
approved these changes
Apr 24, 2026
kkriplani97
approved these changes
Apr 24, 2026
kushalkrip
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item
W-22098350 - Update BuyerGroupEvaluationService example for Apex 67.0 Secure by Default
Summary
Updates buyer group service sample code to support Apex v67.0 "Secure by Default" changes where query mode defaults to USER_MODE instead of SYSTEM_MODE.
Changes
WITH SYSTEM_MODEto 4 SOQL queries + security documentationQueries Updated:
Why These Changes?
In Apex v67.0+, queries default to
USER_MODEwhich enforces field-level security and object permissions. Guest users have no permissions, so queries would fail withoutWITH SYSTEM_MODE. These changes ensure buyer group evaluation works for both guest and logged-in users.Backward Compatibility
✅ Changes are backward compatible with API versions 64-66
✅
WITH SYSTEM_MODEis ignored in older versions (already default behavior)✅ No breaking changes for customers
Testing
Files Changed
commerce/domain/buyergroup/service/classes/BuyerGroupEvaluationServiceSample.cls(+27/-8)commerce/domain/buyergroup/service/classes/BuyerGroupShareableURLSample.cls(+20/-5)Total: 2 files, 32 insertions(+), 15 deletions(-)