Salesforce Certified Platform Developer II — Question 157
In an organization that has multi-currency enabled, a developer is tasked with building a Lightning Component that displays the top ten Opportunities most recently accessed by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user’s locale.
What is the most effective approach to ensure values displayed respect the user’s locale settings?
Answer options
- A. Use a wrapper class to format the values retrieved via SOQL.
- B. Use the FORMAT() function in the SOQL query.
- C. Use the FOR VIEW clause in the SOQL query.
- D. Use REGEX expressions to format the values retrieved via SOQL.
Correct answer: C
Explanation
The FOR VIEW clause in SOQL is specifically designed to format currency and date values according to the user's locale settings, making it the most effective approach for this requirement. The other options do not inherently respect the user's locale settings in the same way; for example, using a wrapper class or REGEX would require additional handling and may not ensure accurate formatting based on locale.