All articles

Agentforce

Field Generation prompt templates: choose the right input contract

Use Field Generation for supported editable fields and evaluate Flex templates when the workflow needs a different input structure.

A prompt can preview successfully and still be the wrong template for the page. Choose its input and output contract first.

Salesforce’s Field Generation tutorial describes linking a template to supported writable text fields in Lightning App Builder. Read-only fields aren’t compatible with that field-generation interaction. The tutorial also introduces Flex templates for a different input structure.

Start with the field’s purpose

Decide whether the generated text is a suggestion for review, a draft summary or a value that drives another process. A field used in approvals or customer communications needs stricter acceptance checks than an internal note.

Confirm the field type, editability, page configuration and user’s access. If the interaction requires a read-only display, changing permissions just to expose a generation button may be the wrong design. Evaluate another supported presentation and invocation pattern.

Use the minimum context needed to produce the text. A case summary may need the relevant case details and approved history, not every available customer field. More context can introduce unrelated or conflicting material.

Ground the prompt with deliberate inputs

State the intended output, allowed sources and handling of missing information. If the source doesn’t contain a resolution, the template should not invent one. Keep instructions distinct from untrusted text retrieved from records or documents.

When the workflow needs inputs beyond the supported Field Generation binding, evaluate a Flex template and its supported invocation method. Flex changes the template structure; it doesn’t automatically provide record updates, user review or a complete action workflow.

Keep the save step explicit. Generating text, accepting it and persisting it should have observable outcomes so the interface doesn’t imply that a draft has already been approved.

Evaluate examples the demo won’t show

Test an empty source, a long source, contradictory notes and text containing instructions that should be treated as data. Include a user who can view the record but cannot edit the target field.

Have a reviewer compare each output with its source. Record unsupported claims, omitted facts and corrections needed. A fluent answer can still be unsuitable for the field’s purpose.

Version the template and retain the evaluation set. Re-run it after changes to the prompt, grounding or model configuration. If generated text enters another automated process, test that downstream behavior as well.

The useful implementation is a reviewable path from permitted inputs to an accepted field value. For broader action workflows, see the AI-agent pilot approach.

Keep reading

All articles