Salesforce
PDII · Question #224
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…
The correct answer is B. Boolean show = User_Prefs__c.getInstance().Show_Help__c. See the full explanation below for the reasoning.
Question
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?
Options
- ABoolean show = User_Prefs__c.getValues(UserInfo.getUserId()).Show_Help__c;
- BBoolean show = User_Prefs__c.getInstance().Show_Help__c;
- CBoolean show = User_Prefs__c.Show_Help__c;
- DBoolean show = User_Prefs__c.getValues().Show_Help__c;
How the community answered
(14 responses)- A7% (1)
- B71% (10)
- C14% (2)
- D7% (1)
Community Discussion
No community discussion yet for this question.