Universal Containers (UC) uses a custom Lightning component with an Apex class to display shipment information (custom object, Private organization-wide default). UC sales managers are complaining about two important points: Shipment records that belong to their teams can be seen by other users.- Shipment amount should be visible only by managers, but sales reps are able to view it. What should the the development team use to avoid these problems?
Comprehensive and Detailed 150 to 250 words of Explanation From Platform Sharing and Visibility Architect/Course Guide/topics:
The valid runtime mechanism among the choices is declaring the Apex class with sharing so Salesforce evaluates record-level sharing when the class queries Shipment records. Because the Shipment OWD is Private, Apex that ignores sharing can expose records outside the user's intended visibility. The sensitive Shipment Amount introduces a second security layer: with sharing does not enforce object CRUD or Field-Level Security. The implementation must separately enforce field access, for example with user-mode operations, Security.stripInaccessible(), or valid Schema Describe checks. System.runAs() is useful for tests but does not secure production execution, and isShareable is not a valid Apex sharing keyword. The correct architecture therefore combines record-sharing enforcement with explicit CRUD/FLS enforcement instead of assuming one mechanism protects every layer. Study Guide reference: Permissions to Standard Objects, Custom Objects, and Fields - with sharing, Apex execution context, CRUD/FLS, user-mode operations, and secure Lightning/Apex architecture. The implementation should also be validated with representative users so effective permissions, sharing inheritance, and any cross-object access behave exactly as designed before production release.
===============