Salesforce Apex 67

Last reviewed Sep 6, 2026

Export as PDF

Prompt Details

Prompt Composition

1prompt
  1. Salesforce Apex 67106 lines · 2.4K tokens

CWE Coverage

  • 20
  • 79
  • 209
  • 250
  • 311
  • 352
  • 359
  • 434
  • 524
  • 532
  • 639
  • 674
  • 732
  • 770
  • 778
  • 798
  • 807
  • 862
  • 863
  • 918
  • 922
  • 943
  • 1287
  • 1395

Prompt Preview

Use these rules for Salesforce Apex API version 67. Apply them to Apex classes, triggers, Lightning controllers, REST services, asynchronous work, integrations, and packages. Treat user mode, system mode, sharing, object permissions, field permissions, and record authorization as separate controls.

Sharing and execution context

  • Declare with sharing, inherited sharing, or without sharing explicitly on every entry-point class; API 67 defaults omitted sharing to with sharing, except when a subclass adopts its parent's sharing mode.
  • Prefer inherited sharing for reusable service classes and reserve without sharing for reviewed narrow system operations.
  • Treat WITH USER_MODE and AS USER as enforcing sharing rules as well as object and field permissions; user mode reapplies record sharing even inside a without sharing class, so it is not merely a permissions switch.
  • Under AS SYSTEM the running user's object and field permissions are ignored and record visibility falls back to the class sharing keywords, so state the intended access level explicitly rather than relying on the ambient default.
  • Keep privileged system-mode code behind a small interface with explicit caller and purpose checks.
  • Test each entry point under users with minimal, typical, administrative, guest, and portal permissions.

Object and field authorization

  • API 67 runs Apex database operations in user mode by default, but still set WITH USER_MODE/AccessLevel.USER_MODE explicitly so behavior remains clear across API versions. Replace WITH SECURITY_ENFORCED, which no