Friday, December 26, 2025

Flex Template in Agentforce: How It Differs from Record & Field Generation Prompt Templates

A Flex Template is a highly customizable prompt template designed to handle multiple use cases with a single prompt. It allows Agentforce to reason over different inputs, contexts, and actions dynamically using LLMs (Large Language Models).

Instead of being tied to a specific object or field, Flex Templates can:

Handle open-ended user questions

Work across multiple objects

Decide the best response format dynamically

Power conversational and decision-based agent flows

What Is a Flex Template in Agentforce?

Flex Prompt Template allows flexible prompt instructions and can optionally include up to five data sources to provide additional context. These inputs help the agent reason across different scenarios and generate intelligent, context-aware responses without being limited to a specific record or field.

Real-Time Example: Case Resolution Assistant (Service Cloud)

Business Scenario

In Service Cloud, support agents receive cases with different issues (billing, login, product defect, delivery delay).

Instead of creating multiple record or field prompt templates, we use one Flex Template that can:

Understand the case context

Analyze case details, customer history, and knowledge articles

Suggest a resolution summary + next best action dynamically

This is ideal for a Flex Template because the response is not limited to a single field or record creation.

What the Flex Template Does

The Flex Template:

Reads Case details

Optionally uses Account information

Optionally uses Knowledge articles

Generates a context-aware response such as:

Case summary

Suggested resolution

Next steps for the agent

Step-by-Step: How to Create the Flex Template

Step 1: Navigate to Prompt Templates

Go to Setup

Search for Prompt Templates

Click New Prompt Template

Step 2: Select Template Type

Choose Flex Template

Click Next

Step 3: Enter Basic Details

Prompt Template Name: Case Resolution Flex Template

API Name: Case_Resolution_Flex_Template

Description:

This Flex Template analyzes case context and optional data sources to generate intelligent resolution suggestions for Service Cloud agents.

Step 4: Add Inputs (Optional – Up to 5)

Click Add and include:

Case Record

Fields: Subject, Description, Priority, Status

Account Record (Optional)

Fields: Account Name, SLA

Note: These inputs help the LLM reason better but are not mandatory.

Step 5: Define Prompt Instructions

Flex Template in Agentforce: How It Differs from Record & Field Generation Prompt Templates

Flex Template in Agentforce

Step 6: Save and Activate

Click Save

Activate the template

Associate it with Agentforce Agent or Flow

Step 7:

For now, Let's preview to save the result:

Flex Template in Agentforce

No comments:

Post a Comment