Salesforce Decode
Salesforcedecode
Back to questions
ApexArchitect (Hardest)multi-currencyetmenterprise

Design Apex for multi-currency and enterprise territory management

Real World Scenario

Global org with dated exchange rates and territory rules requires Apex rollups respecting currency and territory visibility.

Expected Answer

• Use CurrencyType and DatedConversionRate for converted amounts—not manual rates in code • Convert amounts in Apex using convertCurrency in SOQL where possible • Territory-aware queries respect sharing—without sharing only for audited system rollups • Rollups aggregated per territory slice may need batch partitioned by territory Id • Test with multiple currencies and inactive territories in sandbox • Document rounding rules aligned with finance policy • Avoid storing converted and corporate currency inconsistently on same record

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Use CurrencyType and DatedConversionRate for converted amounts—not manual rates in code Also consider: Convert amounts in Apex using convertCurrency in SOQL where possible In practice: Territory-aware queries respect sharing—without sharing only for audited system rollups Document the decision in an ADR and align with enterprise standards.

Architect Perspective

Multi-currency bugs surface at quarter close—architects align Apex calculations with finance source of truth.