Courseiva

SF-PD2 Process Automation, Logic, and Integration Practice Question

A developer is integrating Salesforce with an external ERP using a REST API. The ERP requires that each request include a unique correlation ID for tracing. The developer implements an Apex callout that sends the correlation ID in a custom HTTP header. During testing, the callout succeeds, but the ERP logs show that the correlation ID is missing. What is the most likely cause?

⚠ Common exam trap

The trap here is assuming that headers can be set after the request is sent or that Salesforce strips them, rather than checking that the same HttpRequest instance is used throughout.

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 HTTP request was created using a new HttpRequest() object, but the header was set on a different HttpRequest instance.

The correct answer is that the header was set on a different HttpRequest instance than the one sent. In Apex, HttpRequest objects are not immutable; you must set headers on the same object that you pass to Http.send(). If two instances are created, the header on the unused instance is ignored, leading to the external system not receiving it. This is a subtle but common coding 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 header name must be prefixed with 'X-' to be recognized by the external system.

    Why it's wrong here

    While 'X-' prefixes are common for custom headers, they are not universally required. The external ERP defines its own header naming convention, and the scenario does not indicate that the ERP expects an 'X-' prefix. This option assumes a standard that may not apply, and the ERP's logs show the header missing entirely, not misnamed.

  • ✗

    The custom header was added to the request after the callout was sent.

    Why it's wrong here

    Adding a header after sending the request is impossible because the request is already transmitted. The developer must set headers before invoking the send method on the HTTP object. This option describes a sequencing error, but the scenario states the callout succeeded, implying the request was sent with whatever headers were present at send time.

  • ✓

    The HTTP request was created using a new HttpRequest() object, but the header was set on a different HttpRequest instance.

    Why this is correct

    In Apex, HttpRequest objects are mutable, and headers must be set on the same instance that is passed to Http.send(). If the developer accidentally created two HttpRequest instances, setting the header on one and sending the other, the header would be absent. This is a common mistake when refactoring or copying code, and it matches the symptom of a successful callout with missing header.

  • ✗

    Salesforce automatically strips custom headers from outbound callouts for security reasons.

    Why it's wrong here

    Salesforce does not strip custom headers from outbound callouts. Developers can set arbitrary headers using the setHeader method, and they are sent as part of the HTTP request. This option is a misconception; if headers were stripped, many integrations would fail, and Salesforce documentation confirms custom headers are supported.

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 →

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.