Courseiva

SF-PD2 Testing, Debugging, and Deployment Practice Question

A developer is preparing to deploy a change set from a sandbox to production. The change set includes an Apex class that references a new custom field on Account. The deployment fails with a 'field does not exist' error. What is the most likely cause and the correct action?

⚠ Common exam trap

The trap here is assuming that deploying the field separately first is necessary, when in fact a change set can include both and deploy them together if the field is added.

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

✓

The custom field was not added to the change set; the developer must add the field to the change set and redeploy.

Change sets require all dependent metadata to be included explicitly. When an Apex class references a custom field that is not in the change set, the target org lacks that field, and the deployment fails at compile time. The solution is to add the custom field to the change set and redeploy. This ensures the field exists before the class is compiled, resolving the dependency error.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    The custom field was not added to the change set; the developer must add the field to the change set and redeploy.

    Why this is correct

    Change sets only include components explicitly added. If the Apex class references a custom field that is not in the change set, the target org will not have that field, causing a compile error. Adding the field to the change set ensures the dependency is deployed. This is a common oversight when deploying code that relies on new metadata, and the error message directly indicates the missing field.

  • ✗

    The custom field is not accessible to the deploying user's profile; the developer must grant field-level security and redeploy.

    Why it's wrong here

    Field-level security affects data access at runtime, not the ability to deploy Apex that references the field. A deployment failure due to a missing field is a metadata dependency issue, not a permission issue. Even if the deploying user lacks permission, the deployment would still succeed if the field exists. The error indicates the field is absent from the target org.

  • ✗

    The custom field's API name was changed in the sandbox; the developer must update the Apex class to use the new API name before deploying.

    Why it's wrong here

    If the API name had changed, the Apex class in the sandbox would already reference the new name, and the deployment would fail only if the target org still had the old name. However, the error states the field does not exist, which typically means it was never deployed. Changing the API name in the class would not resolve the missing field in production unless the field is also deployed.

  • ✗

    The Apex class was deployed before the custom field; the developer must deploy the field first, then the class.

    Why it's wrong here

    In a change set, all components are deployed together in a single transaction. The order of addition does not matter; what matters is that all dependent components are included. Deploying the field separately first would work, but the change set approach fails because the field was omitted. The error is not about order but about absence of the field in the deployment package.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.