SP System Architecture and Design 2 — Questions and Answers
Question 1: A company needs to integrate Salesforce with an external ERP system that sends high-volume transactional data. Which integration pattern best handles backpressure and prevents apex governor limit failures?
- Real-time synchronous callout from a trigger
- Batch Apex with Platform Events as a queue (Correct answer)
- Scheduled Flow running every 5 minutes
- REST API polling from the external system
Correct answer: Batch Apex with Platform Events as a queue
Using Platform Events as a buffer with Batch Apex consumer decouples ingestion from processing and respects governor limits at scale.
Question 2: Which Salesforce feature allows an architect to enforce that a custom object record cannot be deleted when related child records exist, without writing Apex code?
- Validation Rule on the child object
- Lookup relationship with Restrict Delete setting (Correct answer)
- Master-Detail relationship
- Before-delete trigger on the parent
Correct answer: Lookup relationship with Restrict Delete setting
A Lookup relationship configured with the 'Restrict Delete' option prevents parent deletion when children exist, declaratively.
Question 3: An org has 50 million Account records. A nightly Batch Apex job queries all Accounts modified in the last 24 hours. Which governor limit is most at risk and how should it be mitigated?
- Heap size — use stateful batch and serialize carefully
- SOQL rows returned — use scope size and incremental LastModifiedDate index (Correct answer)
- CPU time — offload processing to future methods
- DML statements — batch all updates into a single list
Correct answer: SOQL rows returned — use scope size and incremental LastModifiedDate index
SOQL row limits in large orgs are mitigated by reducing scope size and leveraging indexed fields like LastModifiedDate.
Question 4: A solution architect must expose Salesforce data to a mobile app with strict latency requirements. Which approach provides the best performance while keeping data secure?
- SOAP API with full object retrieval
- Composite REST API with field-level query (Correct answer)
- Bulk API 2.0 for real-time reads
- Direct database connection via JDBC
Correct answer: Composite REST API with field-level query
The Composite REST API reduces round trips and allows field-level filtering, minimizing payload size and latency.
Question 5: In a multi-org Salesforce architecture, which mechanism provides the most reliable way to synchronize master data across orgs in near real-time?
- Scheduled Apex polling each org's REST endpoint
- Salesforce Connect with cross-org external objects
- Platform Events published to a shared event bus (Correct answer)
- Outbound Messages triggered by workflow rules
Correct answer: Platform Events published to a shared event bus
Platform Events provide a durable, near-real-time pub/sub channel that decouples the publishing org from subscribing orgs.
Question 6: A company wants to prevent runaway automation — specifically, recursive trigger execution. Which design pattern is the standard Salesforce best practice?
- Add a custom field flag to each record to block re-entry
- Use a static Boolean variable in a handler class set before DML (Correct answer)
- Implement a Platform Cache check before each trigger execution
- Use Process Builder instead of triggers to prevent recursion
Correct answer: Use a static Boolean variable in a handler class set before DML
A static Boolean in a trigger handler class is the standard pattern to track and prevent recursive execution within a transaction.
Question 7: Which Salesforce data architecture pattern should be used when a large enterprise needs to store data that exceeds storage limits but still needs to be searchable within Salesforce?
- Big Objects with SOSL queries
- External Objects via Salesforce Connect (Correct answer)
- Custom Settings for overflow data
- Archiving to a related Salesforce org
Correct answer: External Objects via Salesforce Connect
External Objects via Salesforce Connect allow data to reside in external systems while remaining queryable and searchable within Salesforce.
A company needs to integrate Salesforce with an external ERP system that sends high-volume transactional data.
Which integration pattern best handles backpressure and prevents apex governor limit failures?