SF-PD2 Advanced Developer Fundamentals Practice Question
A developer needs to add a custom field to the Account object that stores a numeric risk score. The field must be available to Apex code, Flow, and the REST API, and must not be exposed on any page layout. Which metadata type and deployment approach should the developer use?
⚠ Common exam trap
A common mix-up: candidates confuse a FieldSet or Layout, which reference existing fields, with the CustomField metadata that actually defines a new field.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a CustomField metadata component on Account and deploy it via a change set or Salesforce CLI, leaving the field off layouts.
The risk score is a new piece of data on Account, so it must be defined as a CustomField metadata component. Custom fields are automatically available to Apex, Flow, and the REST API. Page layout visibility is independent of field existence, so simply not adding the field to any layout satisfies the requirement to keep it hidden from users while retaining programmatic access.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a FieldSet metadata component on Account containing the score field.
Why it's wrong here
A FieldSet is a grouping of existing fields used by Visualforce and Apex, not a definition of a new field. Creating a field set does not create the underlying numeric field, so the risk score would have nowhere to live. The developer must first create the CustomField, then optionally add it to a field set.
- ✗
Create a Layout metadata component and add a hidden numeric field to it.
Why it's wrong here
A Layout references fields that already exist; it cannot define a new field. Adding a field to a layout controls UI placement, not data model creation. Without a CustomField definition there is no field for the layout to reference, and layouts have no bearing on Apex, Flow, or API availability.
- ✓
Create a CustomField metadata component on Account and deploy it via a change set or Salesforce CLI, leaving the field off layouts.
Why this is correct
Custom fields are defined in the CustomField metadata type and are available to Apex, Flow, and the API regardless of page layout visibility. Omitting the field from layouts keeps it hidden from the UI while preserving programmatic and API access. Deploying through a change set or sf project deploy start is the standard way to move the metadata between orgs.
- ✗
Create a CustomObject metadata component with a lookup to Account to store the score.
Why it's wrong here
A separate custom object would store the risk score on a related record rather than on the Account itself. This complicates every read and write, requires relationship queries, and does not satisfy the requirement to add a field to Account. It also introduces unnecessary storage and sharing considerations that a simple numeric field avoids.
About these practice questions
This SF-PD2 question is part of Courseiva's 226-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Salesforce exam blueprint
This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.