Certified Platform Developer II Cheatsheet
Salesforce Certified Platform Developer II
Download free PDFAdvanced Developer Fundamentals (15%)
Sharing and secure execution
- **Organization-wide defaults** establish baseline record access. Roles, sharing rules, teams and shares can extend access; object permissions and field permissions remain separate checks.
- **Apex managed sharing** supports dynamic access driven by user lookups or junction records. For custom objects, write the object's **__Share** records with ParentId, UserOrGroupId, AccessLevel and an appropriate RowCause.
- Use a custom **Apex sharing reason** to distinguish application-managed shares and preserve them through owner changes. Reconcile shares when a reviewer or junction relationship changes or is deleted.
- **with sharing** enforces record visibility, not CRUD or field-level security. Use **user-mode** database operations, describe checks or **Security.stripInaccessible()** as appropriate. **without sharing** must not replace a proper access model.
- External-user sharing depends on the **Experience Cloud license** and relationship model. Sharing sets, roles and programmatic sharing have different applicability; a user lookup alone grants no record access.
Metadata, settings and reusable rules
- **Custom metadata types** store deployable configuration records, such as regional rates, thresholds and package defaults. Their records are available to Apex tests without SeeAllData=true.
- **List custom settings** provide named configuration rows. **Hierarchy custom settings** resolve organization, profile and user overrides; **getInstance()** retrieves merged values for the applicable user context.
- Use settings' **getAll()**, **getInstance()** or **getValues()** for their intended access patterns. Custom setting records are data: create needed values in isolated tests rather than assume sandbox refreshes supply them.
- Keep changeable rules outside hardcoded IDs. Resolve record types through describe information and developer names; use shared service classes so triggers and UI controllers apply the same business rule.
- **Named Credentials** and **External Credentials** manage callout endpoints and authentication. Map credential principals to authorized users through permissions; ordinary settings and static resources are unsuitable for tokens or passwords.
Locale, language and currency
- **Custom Labels** hold translated application text; **Translation Workbench** handles supported metadata translations. **toLabel()** returns translated picklist labels for display, while API values remain suitable for business logic.
- Use locale-aware base components for dates, numbers and currency. Aura exposes **$Locale**; LWC imports **@salesforce/i18n** properties such as firstDayOfWeek. **Date.format()** uses the running user's locale.
- In a multicurrency org, retain each record's **CurrencyIsoCode**. **convertCurrency()** converts supported queried currency values to the user's currency; formatting a number does not perform exchange-rate conversion.
- **FORMAT()** produces display text for supported query fields. Keep typed dates and decimals for calculations and sorting; handle date-only values separately from time-zone-sensitive datetimes.
Process Automation, Logic, and Integration (27%)
Choose automation and understand save order
- Use **record-triggered Flow** for maintainable record automation, **Screen Flow** for guided input, and **Apex** for complex algorithms, transactional coordination or unsupported operations. Declarative automation also consumes platform limits and needs testing.
- **Before-save flows** run before before triggers and efficiently change the triggering record. **After-save** automation suits related records and actions requiring saved record IDs. Approval processes model approval steps and assignments.
- The save lifecycle includes **before triggers**, validation, **after triggers**, later automation, roll-up processing and commit. **After** means after the initial record save, not after transaction commit; asynchronous work runs separately.
- Existing **Workflow Rules** and **Process Builder** automation can cause additional saves and trigger execution. Trace their field updates when diagnosing duplicate children or calculations using values that are populated later.
- Expose bulk-safe Apex actions using **@InvocableMethod** with supported list inputs and outputs; use **@InvocableVariable** on wrapper members. Apex can start an autolaunched flow through **Flow.Interview**.
Bulk triggers and reliable transitions
- Keep a thin **trigger** and move business logic into handler or service classes. Multiple triggers for the same object and event have no guaranteed execution order; coordinate entry points deliberately.
- Collect keys in **Set** collections, query related data once, index it in **Map** collections and perform DML on lists outside loops. Include every downstream trigger and flow when calculating transaction workload.
- In a **before** trigger, change Trigger.new records directly without another update. In an **after** trigger, triggering records are read-only; create children or update related records using separate DML.
- Compare **Trigger.oldMap** with Trigger.new for meaningful transitions, such as open to closed. Make side effects **idempotent** and track processed records where needed; a single static Boolean can incorrectly skip later bulk chunks.
- For lookup roll-ups, handle **insert, update, delete and undelete**, including both parents on reparenting. Aggregate changed parents in bulk and set totals to zero when the last child disappears.
Transactions, partial success and locking
- Ordinary **DML statements** are all-or-none for that operation. **Database.insert(records, false)** permits row-level partial success and returns **SaveResult** entries; inspect errors and map results back to input positions.
- For a required parent-child pair, set a **savepoint** before both inserts and **rollback** on failure. Catching a child exception alone can allow the earlier parent insert to commit; allOrNone on one call does not cover earlier calls.
- **Rollback** restores database changes, but does not reset governor consumption or static variables. Savepoint and rollback operations count toward DML statements; do not reuse invalidated savepoints.
- Use **addError()** to reject invalid records in trigger processing. Catch expected exceptions specifically; **LimitException** cannot be recovered with try/catch. Extend **Exception** for meaningful custom failures.
- Use SOQL **FOR UPDATE** when a read-check-write sequence must lock records, then recheck the business condition under the lock. Plan lock ordering and retries; **Mixed DML** restrictions separate setup-object changes from ordinary business data.
Queueable and future work
- **Queueable** implements execute(QueueableContext) and is submitted with **System.enqueueJob()**. It supports serializable state such as sObjects and returns a job ID for **AsyncApexJob** monitoring.
- Chain a successor Queueable from the current job for ordered stages. Each job gets a separate transaction and limits; use explicit success and retry state because several jobs do not form one atomic transaction.
- **@future** methods are static, return void and accept supported primitive values or collections. Their execution order is not guaranteed. **@future(callout=true)** allows callouts; Queueable callout classes implement **Database.AllowsCallouts**.
- For an exact **save-time snapshot**, pass captured values in a supported asynchronous payload. Passing only IDs and querying later retrieves later database state, which may have changed.
- Enqueue work in bulk. If an endpoint accepts one record per call, partition and chain bounded workloads within the callout limit; avoid one future invocation for every trigger record.
Batch processing and scheduling
- **Database.Batchable** separates **start**, **execute** and **finish**. Start selects work, each execute scope processes a bounded group, and finish performs job-level follow-up. Submit with **Database.executeBatch()**.
- A Batch Apex **QueryLocator** can select up to **50 million** records. Limits reset for each execute transaction; failed scopes do not roll back successful scopes. Use **Database.Stateful** only for necessary instance state across scopes.
- Implement **Database.AllowsCallouts** for batch callouts. Select a scope that fits callout, heap, CPU and DML limits, rather than assuming the default scope suits every integration.
- **Schedulable.execute()** and **System.schedule()** provide timed entry points. Scheduled Apex uses synchronous governor limits; schedule a Batch Apex job for large daily deletions, aggregations or child updates.
- Implement **Database.RaisesPlatformEvents** for automatic **BatchApexErrorEvent** reporting of supported unhandled batch failures. Monitor jobs and design retry handling for failed scopes rather than waiting only for finish notifications.
Relationship queries and search
- **SOQL** queries structured records. Child-to-parent traversal uses **Account.Name** or a custom **__r** relationship; parent-to-child subqueries use the actual child relationship name, such as **Contacts**.
- Use **semi-joins** for parents with matching children: Id IN (SELECT Parent__c FROM Child__c WHERE ...). Use **anti-joins** with NOT IN for parents without matching children; select the child's parent key, not the child Id.
- **GROUP BY**, SUM(), AVG() and COUNT() aggregate in the database. Read **AggregateResult** values through get('alias'), or generated names such as expr0 when no alias is supplied; avoid loading records merely to count them.
- **SOSL** searches text across multiple objects and returns **List<List<sObject>>**, with one result list per RETURNING object. Use SOQL for precise filters and relationships; use SOSL for cross-object text search.
- **DISTANCE(location, GEOLOCATION(latitude, longitude), 'mi')** supports distance calculations, filtering and ordering. Use valid latitude/longitude and consistent units; distance grouping is not an ordinary GROUP BY operation.
Dynamic Apex and safe queries
- Use **Schema.getGlobalDescribe()**, sObject and field tokens, and **getDescribe()** to inspect types, permissions, field sets and picklist entries. **isCustom()** identifies custom objects; Id.getSObjectType() identifies a record's object type.
- Generic **sObject.get('FieldName')** and put() read and write fields dynamically. A field must be present in the query before accessing its queried value; Schema describes metadata rather than a record's stored field values.
- Use **dynamic SOQL** when selected fields or filters vary. Prefer bind variables for values; **Database.queryWithBinds()** resolves named values from a map and supports a chosen access mode.
- Allowlist object names, field names and sort directions. **String.escapeSingleQuotes()** helps with quoted literals but does not secure every query fragment; URL encoding and String.format() do not prevent SOQL injection.
Inbound APIs and external identifiers
- Use standard **REST** or **SOAP** APIs for supported data operations. **Bulk API** handles large asynchronous loads; **Composite** resources reduce round trips for related operations. REST and SOAP share applicable org API allocations.
- Use **Apex REST** for a tailored JSON contract or coordinated business logic: a global **@RestResource** class exposes static methods annotated **@HttpGet**, **@HttpPost**, **@HttpPatch**, **@HttpPut** or **@HttpDelete**.
- An Apex **webservice static** method on a global class exposes SOAP operations. **Enterprise WSDL** is strongly typed for one org's schema; **Partner WSDL** supports generic sObject-based clients across org schemas.
- Use a stable **External ID** for system matching and an explicit **Unique** constraint when duplicates must be rejected. **upsert records External_Id__c** inserts or updates based on that key.
- Relate children through a parent relationship stub containing its External ID, such as child.Account = new Account(Legacy_Id__c = key). Parent resolution does not itself create the parent; coordinate header and line creation in one suitable transaction.
Outbound callouts and authentication
- Use **HttpRequest**, **Http** and **HttpResponse** for HTTP callouts, and **JSON.serialize()/deserialize()** for typed payloads. Generated **WSDL2Apex** clients support SOAP callouts; inputHttpHeaders_x sets needed HTTP headers.
- Reference a **Named Credential** with an endpoint such as callout:ERP/path. Its external credential can supply OAuth or other authentication; use a **per-user principal** when the remote service must recognize each individual user.
- An explicitly coded external endpoint generally needs **Remote Site Settings** authorization unless another supported mechanism covers it. Changing code alone may leave the new host unauthorized; IP login ranges serve a different purpose.
- Call out **before DML**, or move outbound work to a separate asynchronous transaction after the save. Pending uncommitted work blocks ordinary callouts; Database.insert(..., true) does not force an immediate commit.
- For **mutual TLS**, configure the client certificate and use the supported credential configuration or **HttpRequest.setClientCertificateName()**. The remote endpoint must trust the certificate; an Authorization header alone is not TLS client authentication.
- Use **Continuation** for supported UI-driven long-running callouts and callbacks. Chain dependent requests when one response supplies the next input; Continuation does not remove service timeouts, payload limits or failure handling.
Events and integration patterns
- **Platform Events** decouple publishers from subscribers. Publish through **EventBus.publish()**, supported Flow actions or APIs; external subscribers consume event channels through supported event APIs.
- Choose **Publish After Commit** when subscribers must see committed record changes. Treat delivery as potentially repeated and design **idempotent** consumers with replay and recovery behavior; a successful publish enqueue result is not proof of downstream processing.
- **Change Data Capture** reports supported record changes. **Lightning Message Service** coordinates UI components; it is distinct from server-side Platform Events and CDC. LWC **lightning/empApi** subscribes to supported streaming channels in supported containers.
- **Outbound Messaging** provides SOAP notifications, acknowledgments and built-in retries. Listeners must handle duplicates and out-of-order delivery. Use Apex HTTP callouts when an external service requires REST or custom response processing.
- **Salesforce Connect** exposes supported external data through external objects instead of copying it. **ETL** suits scheduled bulk synchronization; **Messaging.InboundEmailHandler** processes inbound email. **ConnectApi** exposes supported collaboration operations in user context.
User Interface (20%)
Visualforce controllers and lifecycle
- A **standard controller** supplies object-level record actions; **StandardSetController** supplies list behavior and pagination. A **controller extension** receives the standard controller and adds behavior; a custom controller owns its page logic.
- With several extensions, the **leftmost matching extension method** takes precedence over later extensions and the standard controller. Keep shared rules in services rather than depend on duplicated controller methods.
- Initial **GET** processing constructs controllers and components, evaluates page expressions and actions, and builds view state when applicable. **Postback** restores state, processes submitted values and validation, invokes the action, then renders or redirects.
- Keep **getters** side-effect-free because their evaluation order and frequency are not guaranteed. **PageReference.setRedirect(true)** causes a new browser request; server-side forwarding can retain state only under compatible controller conditions.
Visualforce Ajax, remoting and messages
- **apex:actionSupport** attaches Ajax behavior to an event; **apex:actionFunction** exposes a controller action to JavaScript; **apex:actionPoller** invokes an action periodically. **rerender** identifies components for a partial page update.
- **apex:actionRegion** limits which inputs participate in server processing; it does not select the redraw target. **apex:actionStatus** displays in-progress and completion content. Use a stable rendered container around conditionally displayed targets.
- **@RemoteAction** methods are public or global and **static**. JavaScript Remoting calls custom Apex asynchronously without transmitting Visualforce view state; handle callback results and errors explicitly.
- **ApexPages.addMessage()** supplies page messages; **apex:pageMessages** displays the styled message collection. **apex:message** targets one component. Custom Visualforce components use **apex:attribute** for configurable inputs.
Aura exposure, actions and communication
- Set the Aura component's **controller** and call **component.get('c.methodName')**, setParams(), setCallback() and **$A.enqueueAction()** for Apex actions. Server methods must be public or global, static and **@AuraEnabled**.
- Use **aura:handler name="init"** for initialization. Inspect SUCCESS and ERROR callback states and return meaningful handled server errors; avoid firing events repeatedly from custom renderers.
- Use **flexipage:availableForRecordHome** for record-page availability, **force:hasRecordId** for record context and **force:hasSObjectName** for object context. **design:attribute** exposes supported App Builder configuration.
- **force:lightningQuickAction** and **force:lightningQuickActionWithoutHeader** expose quick actions. **lightning:actionOverride** supports standard action overrides; Classic requires a suitable Visualforce override, which can host supported Lightning content.
- Aura **component events** communicate through the component hierarchy; **application events** broadcast to interested handlers. Prefer **Lightning Message Service** for supported communication across unrelated components and technologies.
LWC data access and Apex contracts
- Prefer **Lightning Data Service** and UI API adapters for supported record operations, metadata, caching and security enforcement. Request explicit fields rather than a full layout when only a few fields are needed.
- Import Apex using **@salesforce/apex/ClassName.methodName**. Public or global static **@AuraEnabled** methods expose supported data; annotate serializable wrapper properties too. LWC-exposed Apex contracts must use supported types.
- **@wire** provisions reactive data. Wired Apex requires **@AuraEnabled(cacheable=true)** and read-only behavior. In wire configuration, **'$recordId'** references a reactive property; handle both data and error results.
- Use **imperative Apex** for mutations, noncacheable methods or user-controlled calls. Pass a JavaScript object whose property names match Apex parameters, and handle the returned promise.
- Retain the full Apex **wire result** for **refreshApex()** after changes. When Apex changes records used by LDS, use **notifyRecordUpdateAvailable()** where appropriate; changing an array reference alone does not refresh server data.
LWC lifecycle, events and exposure
- **connectedCallback()** handles connection to the DOM; **renderedCallback()** runs after rendering and can run repeatedly. Guard one-time initialization and avoid state updates that create render loops.
- Expose parent-supplied properties and methods with **@api**. Send changes upward with **dispatchEvent(new CustomEvent(...))** and a detail payload. Treat input data as owned by the parent; use **Lightning Message Service** across unrelated components.
- Use a JavaScript **getter** for calculated template values, such as quantity multiplied by unitPrice. Reassign arrays and objects deliberately when updating displayed data; retain stable keys for rendered lists.
- Set **isExposed** and supported **targets** in the component's js-meta.xml. **lightning__RecordPage** exposes a record-page component; a modal quick action uses **lightning__RecordAction** with **ScreenAction** target configuration.
- Set supported **form factors** in the relevant target configuration when availability must be desktop-only. For navigation and workspace behavior, choose APIs supported by the target container; use an Aura wrapper where an existing interface requires it.
Forms, responsive layout and assets
- Use **lightning-record-edit-form** with **lightning-input-field** for flexible record forms, and **lightning-messages** for server validation errors. Use lightning-input with explicit validity checks when custom client validation is needed.
- Show **field-level and inline errors** near the failing input. Check reportValidity() across relevant controls before submit, retain server-side validation, and aggregate page errors when repeated toasts would overwhelm the user.
- Use **lightning-layout** and **lightning-layout-item** with a 12-column grid. A base **size="12"** stacks on phones; **medium-device-size="6"** produces two columns at medium and larger breakpoints. Select breakpoints deliberately for the supported devices.
- Package JavaScript, CSS and images as **static resources**, including archives with relative paths. Visualforce uses **$Resource** and URLFOR; Aura uses **ltng:require**. Uploading a resource does not automatically minify it.
- In LWC, default-import **@salesforce/resourceUrl/resourceName**, import **loadScript/loadStyle** from **lightning/platformResourceLoader**, and await their promises. Match library loading and DOM access to the component lifecycle and security model.
- **Visualforce renderAs="pdf"** supports server-rendered PDFs within its rendering restrictions. Choose LWC for interactive Lightning experiences and reuse Aura or Visualforce where required by existing containers or overrides.
Testing, Debugging, and Deployment (20%)
Isolated Apex tests and assertions
- Use **@isTest** and create test records explicitly. **SeeAllData=false** isolates ordinary business data; some setup metadata remains visible. Tests roll back their changes and must not depend on execution order or production records.
- Use **@testSetup** for common baseline records and a **test data factory** to centralize valid defaults. Query setup records within each test; changes in one test do not become another test's baseline.
- **Test.loadData(sObjectType, 'ResourceName')** loads CSV test fixtures from static resources. Create custom setting rows when needed; custom metadata configuration is visible without opting into org business data.
- Test positive, **negative**, bulk and boundary cases with meaningful assertions. Requery stored records after triggers or asynchronous work before checking persisted values; setup execution alone is not a substitute for testing the behavior.
- **System.runAs()** tests record sharing for different users. It does not automatically enforce CRUD or field permissions in system-mode code; test explicit user-mode or permission enforcement separately. **@TestVisible** exposes selected internals to tests without changing their public API.
Async, callout and controller tests
- Put setup before **Test.startTest()**, invoke the behavior under test, then call **Test.stopTest()** before assertions on queued asynchronous work. This isolates the tested limit context; it does not repair production code that exceeds limits.
- For Batch Apex, call **Database.executeBatch()** and keep the selected test work within one execute scope. Test chained async stages independently rather than assume stopTest() executes an entire nested chain.
- Implement **HttpCalloutMock** for HTTP or **WebServiceMock** for SOAP and register it with **Test.setMock()**. StaticResourceCalloutMock and MultiStaticResourceCalloutMock provide fixture-based HTTP responses; assert request and response handling, including failures.
- Use **Test.setCurrentPage()**, set required page parameters, then instantiate the controller. For extensions, construct **ApexPages.StandardController(record)** and pass it to the extension; assert returned PageReference URLs and messages.
- Use **Test.setFixedSearchResults()** for deterministic SOSL results. Inject a selector or service for difficult-to-create system history data; avoid disabling real logic with Test.isRunningTest() merely to obtain coverage.
Jest tests for Lightning web components
- Use **Jest** for component behavior: DOM output, public properties, user interaction and dispatched events. Apex tests validate server behavior; Jest does not execute real Salesforce services or replace full integration testing.
- Create the component, set its public inputs, append it to the document and inspect its **shadowRoot**. Dispatch realistic input or click events and assert visible results rather than nonpublic implementation details.
- Mock Apex and wire adapters. For **getRecord**, import the adapter and emit JSON fixture data or errors, then wait for rendering with a resolved **Promise** before asserting the DOM.
- LWC renders asynchronously after reactive changes. Await the relevant microtask or mocked operation, and remove appended DOM nodes in **afterEach()** so conditional components and listeners cannot leak into later tests.
Trace the correct runtime
- Use Apex **debug logs** and appropriate trace flags for server execution. Inspect **SOQL_EXECUTE_END**, cumulative limits and workflow evaluations; adjust the relevant category and level rather than enable every possible detail.
- Developer Console **Execution Overview**, executed units and execution trees show call counts and expensive paths. Many short repeated operations can consume more time than one conspicuous long operation.
- Use **Apex Replay Debugger** with suitable logs and checkpoints in VS Code to inspect execution state; supported **Apex Interactive Debugger** sessions provide live debugging. Browser breakpoints and console logs inspect client JavaScript.
- Enable **Lightning Debug Mode** for the debugging user and use browser network and developer tools. Lightning Inspector can inspect Aura actions, events and storage; server logs do not show arbitrary client JavaScript execution.
- Use **Setup Audit Trail** to investigate configuration changes and **Event Monitoring** for supported user activity logs. Field history is a distinct record-change feature with retention and API-access constraints; do not assume indefinite history availability.
Source-driven delivery and coverage
- Keep deployable metadata in **version control** and use **Salesforce CLI** in CI/CD for validation, deployment, test execution and deployment reports. Coordinate shared components and dependencies before promoting a release.
- Use isolated development environments, then **integration/CI** and representative **staging/UAT** environments. A shared full sandbox alone does not isolate concurrent changes. Compare releases, API versions, permissions and configuration when behavior differs.
- **Change sets** move selected metadata between connected orgs; they do not merge competing versions of a component. Review layouts, automation and dependencies together; deploy required reference configuration intentionally.
- Production Apex deployment generally requires **75% overall Apex coverage**, passing required tests and coverage for every trigger. **RunSpecifiedTests** applies coverage requirements to deployed classes and triggers individually; coverage measures execution, not business correctness.
Performance (18%)
Budget the entire transaction
- Common transaction limits include **100 synchronous / 200 asynchronous SOQL queries**, **50,000 SOQL rows**, **150 DML statements** and **10,000 DML rows**. Related triggers and flows share the transaction's budget.
- **SOSL** allows 20 queries per transaction and 2,000 returned records per query. Callouts allow **100 requests** and **120 seconds cumulative timeout**. Async execution does not remove these ceilings.
- CPU limits are **10 seconds synchronous / 60 seconds asynchronous**; trigger recursion depth is **16**. Synchronous transactions can enqueue up to **50 Queueables**, while an executing asynchronous transaction normally enqueues **one** successor.
- Use **Limits.getX()** for usage and **Limits.getLimitX()** for the ceiling. Track heap, CPU, queries and rows; **sendEmail** invocations and daily recipient allocations are separate constraints. An asynchronous design still needs an org-wide capacity budget.
Selective queries and query plans
- Use the **Query Plan tool** to compare leading operations, estimated **cardinality** and relative cost against actual filter values. An indexed field is helpful only when the filter is selective enough to drive a good plan.
- Prefer selective positive filters on **Id**, suitable foreign keys, **External IDs** or supported custom indexes. Negative filters, leading-wildcard LIKE and broad OR conditions can prevent efficient index use.
- Standard indexes generally omit **nulls**. Consider supported null-enabled custom indexes or an indexable normalization design when null searches are material; making a field required does not fix existing missing values by itself.
- Filter in **SOQL**, retrieve only required fields and use database aggregates. **LIMIT** changes the result size, not necessarily the access path; use it only when returning a subset satisfies the requirement.
Large data volumes and pagination
- Use **Batch Apex** for large in-org processing and **Bulk API / ETL** for large external transfers. Partition by suitable keys, reduce parent contention, monitor failures and run disruptive synchronization outside busy periods where possible.
- Use **StandardSetController** for suitable Visualforce result navigation. **LIMIT / OFFSET** supports shallow pagination, but OFFSET can skip at most 2,000 rows and does not guarantee a fixed snapshot as data changes.
- For deeper results, use API query cursors and **queryMore/nextRecordsUrl**, or suitable keyset pagination with deterministic ordering. Keep a stable result identity when the requirement is to browse the originally selected results.
- **Big Objects** suit very large historical datasets and use **__b** names. SOQL filters must follow a contiguous prefix of the defined index: preceding fields use equality, and the last filtered field supports permitted equality, range or IN operators.
Reduce memory, latency and repeated work
- Visualforce **view state** has a **170 KB** ceiling. Paginate, filter and lazy-load instead of storing entire datasets. **transient** and static fields are excluded from view state; private or final alone does not exclude a field.
- **transient** does not remove runtime heap usage. Process query results with **SOQL for loops**, keep collection lifetimes short and avoid accumulating every record again in a second collection.
- Use read-only **cacheable Apex**, LDS and lazy rendering for reusable reference data; refresh after changes. In Aura, **setStorable()** applies to suitable actions. Measure page composition with **App Builder performance analysis** and browser tools.
- Use **Map** lookups instead of repeated nested scans, and share selectors, integration clients and business services. An **interface** with interchangeable implementations supports varying algorithms, such as commission strategies, without copying trigger logic.