> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-a-placeholder-when-no-pdf.md). Agents can also search and read this documentation through its [MCP server](https://docs.avonnicomponents.com/~gitbook/mcp).

# Show a Placeholder When No PDF Is Attached

Show a clear message and an illustration when a record has no PDF yet, so users know the contract is missing instead of staring at an empty frame.

A new Opportunity has no contract yet. Without a source, the [PDF Viewer](https://docs.avonnicomponents.com/dynamic-components/components/pdf-viewer.md) draws an empty frame, and an account executive cannot tell whether the file is missing or the page is broken. A placeholder says it plainly: "No signed contract yet. Upload it in the Files related list."

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FG30GmmhNh3Cp6Imfbey3%2Fpdf-viewer-placeholder-result.png?alt=media" alt="No Content illustration with the message No signed contract yet. Upload it in the Files related list." width="480"><figcaption><p>Northwind Spare Parts has no contract: the placeholder says so.</p></figcaption></figure>

## Before you start

* The contract viewer from [Show the Latest Contract on an Opportunity](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-the-latest-contract-on-an-opportunity.md): a PDF Viewer whose **Source** is `{!contractFileId}`, filled by a Flow **On Load**.
* An Opportunity with no PDF to test with. This page uses Northwind Spare Parts.

## Build it

Choose how you want to build:

✨ **Build with AI**: give your AI assistant a ready-to-use prompt.

🛠️ **Build with clicks**: follow the steps in the builder yourself.

{% tabs %}
{% tab title="Build with AI" icon="wand-magic-sparkles" slug="placeholder-build-with-ai" %}
The `avonni-dynamic-components` skill adds the placeholder settings to your existing PDF Viewer; Salesforce must already hold the component from the previous tutorial.

{% stepper %}
{% step %}

### Set up the Avonni Skills and MCP server

Follow [Setup](https://docs.avonnicomponents.com/dynamic-components/build-with-ai/setup.md) to install the Avonni Skills, connect your AI assistant to the Avonni MCP server, and sign in to your sandbox through Salesforce CLI.

Have the contract viewer component from [Show the Latest Contract on an Opportunity](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-the-latest-contract-on-an-opportunity.md) in your sandbox.
{% endstep %}

{% step %}

### Copy the prompt and review the plan

Paste the prompt into your configured assistant. Check the target org and the field mappings in its plan before you approve it.

{% prompt description="Prompt for this tutorial" icon="wand-magic-sparkles" openInAIProviders="false" defaultExpanded="partial" %}
{% code overflow="wrap" collapsedlinecount="10" %}

```
Use the avonni-dynamic-components skill. Verify the dcPdfViewer component and its placeholder properties against the Avonni MCP server (dynamic toolset) before you use any name.

Inspect my sandbox: find the Dynamic Component that holds a PDF Viewer with Source {!contractFileId} and the On Load Execute Flow Get_Latest_Contract_PDF (replace with the API name of my flow), and confirm it with me before changing it.

On that PDF Viewer, turn on Show Placeholder, set Placeholder Message to "No signed contract yet. Upload it in the Files related list." and Placeholder Illustration to No Content. Change nothing else.

Show me the plan and the field bindings before writing files. Then draft the local metadata, list what is left to set up by hand, and stop before deployment or activation.
```

{% endcode %}
{% endprompt %}
{% endstep %}

{% step %}

### Deploy to the sandbox and check the result

Review what the assistant generated and what it left for you to configure. Deploy the approved files to your sandbox only, finish any remaining setting with the **Build with clicks** tab, then check that Northwind Spare Parts shows the message and Northwind Fleet Renewal still shows its contract.
{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Build with clicks" icon="screwdriver-wrench" slug="placeholder-build-with-clicks" %}
{% stepper %}
{% step %}

### Turn on the placeholder

1. Open the contract viewer component and select the **PDF Viewer**.
2. In the Properties tab, expand the **Placeholder** section. It is collapsed by default.
3. Turn on **Show Placeholder**. The two other settings of the section appear.
   {% endstep %}

{% step %}

### Write the message and pick an illustration

1. Set **Placeholder Message** to `No signed contract yet. Upload it in the Files related list.` Say what is missing and where to add it.
2. Set **Placeholder Illustration** to **No Content**. Pick **Text Only** to show the message without a picture.

You can also build the message from the record: **Placeholder Message** accepts resources, for example `No contract on {!$Component.Record.Name} yet.`
{% endstep %}

{% step %}

### Save and test

1. Save the component.
2. Open Northwind Spare Parts. The viewer shows the No Content illustration and "No signed contract yet. Upload it in the Files related list."
3. Open Northwind Fleet Renewal. The viewer shows Service Contract 2027 (signed): with a PDF in **Source**, the placeholder does not appear.
   {% endstep %}
   {% endstepper %}
   {% endtab %}
   {% endtabs %}

## Troubleshooting

<details>

<summary>The frame is still empty on a record with no PDF</summary>

**Show Placeholder** is off, or **Source** is not truly empty. The placeholder only appears when **Source** has no value. If the Flow returns text that is neither an Id nor a URL, **Source** holds that text: the viewer cannot read it and the placeholder stays hidden. Check the Flow's output on that record.

</details>

<details>

<summary>The placeholder shows on a record that has a contract</summary>

The Flow did not return the file, so **Source** is empty. Check the file's title, extension and the record it was uploaded to, as in [Show the Latest Contract on an Opportunity](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-the-latest-contract-on-an-opportunity.md).

</details>

## Related tutorials

* [Show the Latest Contract on an Opportunity](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-the-latest-contract-on-an-opportunity.md): the viewer this page adds a placeholder to.
* [Pick a PDF from a List and Read It](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/pick-a-pdf-from-a-list.md): the same placeholder, shown until the user clicks a file.
* [Show a PDF from a URL on a Record](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-a-pdf-from-a-url.md): what to check when the frame is blank although a source is set.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/pdf-viewer/show-a-placeholder-when-no-pdf.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
