---
schema_version: "1"
id: ef67a50dbbbc51c41e268e0518e2daf6860b5f09ebbc5822d5ccf801e49c54cf
title: Remove a Template Reference in an Apex Class
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_remove_template_reference_apex.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_remove_template_reference_apex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 9284b9414d8676457159c6ea52ebe6d8ae9cdd52ce032bdc9afbb6f0030d9c08
description: Remove dependencies on a prompt template so you can safely delete or modify the template without breaking other components.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Remove a Template Reference in an Apex Class

Remove dependencies on a prompt template so you can safely delete or modify the template without breaking other components.

### 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="d53264e69">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d53264e69 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d53264e69 ">
              <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>

1. For each Apex reference listed, from Setup, in the Quick Find box, enter Apex Classes, and then select **Apex Classes**.
2. Open the Apex class.
3. Locate the prompt template reference.
4. Update the code to use a different template, or remove the invocation.
5. Deploy the updated Apex class.
6. Return to Prompt Builder, and then repeat the steps to open the Delete Template modal.
7. Verify that no references appear.
8. Delete the template version, or update the template as needed.