Apex Aide apexaide

Invoke Agentforce Prompt Template From Salesforce Flows

Salesforce FAQs· ·Intermediate ·Admin ·6 min read
Summary

This guide demonstrates automating updates to a custom Account summary field in Salesforce by invoking an Agentforce prompt template via a Record-Triggered Flow. Instead of manually clicking a 'Generate' button after each Account update, the Flow automatically triggers the prompt template to refresh the summary field. Salesforce teams can leverage this approach to streamline AI-generated field updates by integrating Agentforce prompts directly within Flows, boosting efficiency and reducing manual steps.

Takeaways
  • Create Record-Triggered Flows to automate Agentforce prompt template invocation on updates.
  • Use a Text Variable resource to store AI-generated prompt responses within Flow.
  • Assign prompt response variables to custom fields to update records automatically.
  • Optimize Flow for action and related records to handle prompt template output efficiently.
  • Set entry criteria so the Flow only triggers when relevant fields are updated.

In Agentforce, we have various types of prompt templates that can be invoked from AI Agent, Apex , Flows, or record pages in Salesforce. For example, I created a Field Generation Prompt Template on the Account object that summarizes information about a particular account and displays it in a custom field named Account Summary__c. Now this prompt template is invoked on the Account record page, wher e we add the field ( Long Text Area ). When a user clicks the Generate button, the information will be summarized in that field. However, here the problem is that whenever we update the account record, we need to click the generation button to update the account summary stored in the Account Summary__c field. Now we want to automate this process so that whenever a user updates the account record, the summary field is automatically updated to reflect the value changed in the account record.

AgentforceFlow BuilderAutonomous & Agentic WorkflowsSalesforce AgentforceInvoke Agentforce Prompt Template From Salesforce Flows