Cert++
Close

Flow and Apex input compatibility with prompt templates

Key Takeaway

A flow or Apex class works with a prompt template only when the template can supply every input that the flow or class requires. Every flow input counts as required, but Apex inputs are optional unless they are annotated as required.

Prompt templates can pull in data from flows and Apex, not just from record fields. You use flows and Apex when grounding needs logic or filtering before the data reaches the LLM. Whether a flow or Apex class fits a template depends on the template's inputs and on the inputs that the flow or class requires.

Grounding a prompt with flows and Apex

In Prompt Builder, the "Insert Resource" button adds merge fields to a prompt template. These merge fields can reference the following resources:

  • Record fields
  • Flows
  • Apex
  • Data 360 DMOs
  • Related lists

A record field gives the prompt a raw field value. Unlike a record field, a flow or Apex class lets you ground the prompt with the result of logic.

The actions that a template uses appear in its Resources tab.

Filtering is one reason to use an action. When a template returns data that a user shouldn't see, or leaves out data that the user should see, add an Apex or flow action that filters the records before that data is grounded in the prompt template.

Agentforce Specialist Study Guide

Checklist progress

0/204Learned

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Agentforce Specialist studiers.