複数通貨が有効になっている組織では、開発者は、ログインしているユーザーが最近アクセスした上位 10 件の商談を表示する Lighting コンポーネントを構築するという任務を負っています。開発者は、Amount フィールドと LastModifiedDate フィールドの値がユーザーのロケールに従って表示されていることを確認する必要があります。
表示される値がユーザーのロケール設定に従っていることを確認するための最も効果的なアプローチは何ですか?
正解:D
To ensure the values displayed respect the user's locale settings, the most effective approach is to use the FORMAT() function in the SOQL query. The FORMAT() function converts the field values in the query result to the user's locale, if the field is a date, date/time, currency, number, or percent field. The FORMAT() function also respects the multi-currency settings, and converts the currency values to the user's currency. The developer can use the FORMAT() function for the Amount and LastModifiedDate fields in the SOQL query, and display the formatted values in the Lightning component. Using REGEX expressions to format the values retrieved via SOQL would not be effective, as it would require complex and error-prone string manipulation, and it would not respect the multi-currency settings. Using a wrapper class to format the values retrieved via SOQL would not be effective, as it would require additional Apex code and memory allocation, and it would not respect the multi-currency settings. Using the FOR VIEW clause in the SOQL query would not be effective, as it would only mark the records as viewed, but it would not format the field values according to the user's locale. Reference: [SOQL Functions], [Working with Currencies]