Salesforce Platform Developer I (legacy) — Question 201
A custom picklist field, Food_Preference__c, exists on a custom object. The picklist contains the following options: `˜Vegan', `˜Kosher', `˜No Preference'. The developer must ensure a value is populated every time a record is created or updated.
What is the most efficient way to ensure a value is selected every time a record is saved?
Answer options
- A. Mark the field as Required on the field definition.
- B. Set ג€Use the first value in the list as the default valueג€ as True.
- C. Mark the field as Required on the object's page layout.
- D. Set a validation rule to enforce a value is selected.
Correct answer: A
Explanation
The correct answer is A because marking the field as Required in the field definition ensures that a value must be provided before a record can be saved. Option B does not enforce selection but rather assigns a default value, while option C only enforces the requirement on the page layout and not at the database level. Option D, while viable, is less efficient than simply marking the field as Required.