---
schema_version: "1"
id: 72fb81eb27ee0909d1db48b6cf66a737ced408a540fdbbe5f149cb51c8bfe118
title: Add File Inputs to a Flex Prompt Template
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_add_file_flex.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_file_flex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 151402d1a8112e37dcf6cc158233719e12d9c56cc17c5b932be1cf95aab2091a
description: Create a flex prompt template that includes file inputs.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Add File Inputs to a Flex Prompt Template

Create a flex prompt template that includes file inputs.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d170772e68">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d170772e68 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d170772e68 ">
              <p>Prompt Template Manager permission set</p>
              <ul>
                <li>Manage Prompt Templates</li>

                <li>Execute Prompt Templates</li>

              </ul>
              <p>OR</p>
              <p style="margin-bottom:0;">Customize Application permission set</p>
            </td>

          </tr>
        </tbody>
      </table>

Here’s an example scenario of a flex prompt template that uses a file input. Say you're designing a prompt template to verify product images in an e-commerce listing before publication. Your Flex prompt template compares uploaded product images to the listing description to ensure that colors, sizes, and details are accurately represented. You're interested because this prompt template helps maintain consistency across listings and improves product accuracy and customer trust.

To get started, create a prompt template.

1. In the Prompt Template Type dropdown, select **Flex**.
2. For the Prompt Template Name, enter Image Comparison.
3. In the description field, enter E-Commerce Product Image Verification
4. Define three resources. For the first image, enter:
    1. Name: Image1
    2. API Name: Image1
    3. Source Type: **Object**
    4. Object: File
5. Click **Add**.
6. For the second image, enter:
    1. Name: Image2
    2. API Name: Image2
    3. Source Type: **Object**
    4. Object: File
7. Click **Add**.
8. For the product description, enter:
    1. Name: Description
    2. API Name: Description
    3. Source Type: **Object**
    4. Object: Product2
9. Click **Next**, and you’re redirected to the Prompt Template Workspace.
10. Copy and paste the example prompt template
    1. To use the example prompt, copy the E-Commerce Product Image Verification prompt in the [Flex Example Templates](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_flex_example_templates.htm&release=264.0.0&type=5 "These example prompt templates cover a few use cases for flex."). Then, paste it into the Prompt Template Workspace.
    2. Before you can run this template in Prompt Builder, in the Prompt section, click **Insert Resource**.
    3. In the Inputs menu, replace the description placeholder with a real merge field.
11. Add the related list to the prompt template, from the Resource picker, click **Product2**, then **Notes & Attachments**.
    
    Prompt Builder grounds files in this related list that are Salesforce Files. Classic Attachment records aren’t included in the resolved prompt. See [Grounding with Related List Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_related_list.htm&release=264.0.0&type=5 "Ground your prompt templates with your object’s related lists to add depth and context to your grounding.").
12. In Template Settings, under Model, select **GPT 4 Omni**.
13. In Preview Settings, click **Inputs**. In the Inputs section, you see the three objects that you created.
14. Click **Select File** to choose a file stored in your org. You can select an existing file or upload a new one.
15. Select a product for your description grounding data.
16. After the files and the product description are added, click **Save & Preview** to test the prompt template. You can also preview attached images in the Resolved Prompt section.

Prompt Builder grounds related-list files that are Salesforce Files. Classic Attachment records aren’t supported. If a file from **Notes & Attachments** doesn’t appear in the resolved prompt, then convert it to a Salesforce File or upload it from the **Files** related list, and preview again. File size and system limits aren’t the cause. See [Grounding with Related List Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_related_list.htm&release=264.0.0&type=5 "Ground your prompt templates with your object’s related lists to add depth and context to your grounding.").

For supported types and conversion behavior, see [Grounding with File Inputs](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_file.htm&release=264.0.0&type=5 "Ground generative AI prompt templates with files so the AI model can use documents, spreadsheets, presentations, images, and email text in the resolved prompt.").

#### See Also

- [Grounding with File Inputs](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_file.htm&release=264.0.0&type=5 "Ground generative AI prompt templates with files so the AI model can use documents, spreadsheets, presentations, images, and email text in the resolved prompt.")