Salesforce Certified Platform Developer II — Question 75

Universal Containers stores user preferences in a Hierarchy Custom Setting, User_Prefs_c, with a Checkbox field, Show_Help_c. Company-level defaults are stored at the organizational level, but may be overridden at the user level. If a user has not overridden preferences, then the defaults should be used.
How should the Show_Help_c preference be retrieved for the current user?

Answer options

Correct answer: B

Explanation

The correct answer is B, as User_Prefs__c.getInstance() retrieves the current user's preferences, allowing for the appropriate defaults or overrides to be applied. Option A is incorrect because it requires a specific user ID, which doesn't account for the current user context. Option C is wrong because it does not consider user-specific settings and defaults to the organization level. Option D is incorrect as it attempts to get values without specifying a user, thus not providing the necessary context for the current user.