Building a prompt template is iterative. Define the use case, write the initial prompt, ground with the right data, preview against realistic records, refine the wording until output quality is consistent. Most of the value is in iteration; one-shot prompts rarely produce production-quality results.
- Define the use case and audience
What content should the template generate? Who consumes it? Sales outbound emails for prospects, service response drafts for agents, summaries for executives. Clarity on use case drives every downstream choice.
- Open Prompt Builder and create a new template
Setup > Prompt Builder > New Prompt Template. Pick the template type (Sales Email, Field Generation, Record Summary, Flex). Provide a name and description.
- Pick the LLM target
Choose the LLM. Salesforce-hosted models for default use. OpenAI, Anthropic, or other Trust Layer models for specific quality or feature needs. Bring-your-own LLM for custom endpoints.
- Configure grounding sources
Pick the records and related data the prompt needs. Current record, related records, Knowledge, Data Cloud objects, custom Apex data. Strong grounding is the difference between accurate output and hallucinated content.
- Write the prompt with merge fields
Draft the prompt text. Insert merge fields from the grounding sources where appropriate. Frame the LLM''s task clearly: be specific about tone, length, format. Vague prompts produce inconsistent output.
- Preview against sample records
Use the Preview panel to test against real records. Review the resolved prompt (after merge field substitution) and the LLM''s response. Iterate on the prompt wording, grounding, and merge fields until output is consistent and accurate.
- Activate the template for the right surfaces
Configure where the template appears: Sales Engagement, record page Einstein component, Agentforce action, Flow. The activation makes the template available to users; without it, the template stays admin-only.
- Monitor usage, quality, and credit consumption
Setup > Einstein Generative AI > Usage. Track which templates run most often, which produce thumbs-up versus thumbs-down feedback, and the credit consumption. Iterate on weak templates and budget for high-use ones.
Sales Email, Field Generation, Record Summary, or Flex. Drives the input parameters and expected output format.
Salesforce-hosted, Trust Layer third-party (OpenAI, Anthropic), or bring-your-own. Different cost and quality trade-offs.
Records, related data, Knowledge, Data Cloud, or custom Apex. Determines what real data the prompt draws on.
- Ungrounded prompts hallucinate. The LLM confidently states facts that are not in your data unless you ground the prompt with real Salesforce context. Always configure grounding for data-specific output.
- Prompt quality requires iteration. One-shot prompts rarely produce production-quality output. Plan multiple Preview cycles and refine the wording until results are consistent.
- Einstein Credits consume per invocation. High-volume templates produce significant credit spend. Monitor consumption and plan budget accordingly.
- Vague prompts produce inconsistent output. Be specific about tone, length, format, and what to do when data is missing. The LLM follows instructions; ambiguous instructions produce variable output.
- Template activation gates where users see the output. Forgetting to activate for the right surface means the template stays admin-only and produces no business value.