Agentforce empowers Salesforce users to automate tasks and deliver intelligent responses through conversational AI. One powerful capability is invoking Salesforce Flows directly from Agentforce topics. In this article, we’ll demonstrate how to achieve this using a practical scenario: fetching Case details by Case Number.
Scenario Overview
We want our Agentforce agent to retrieve
case details when a user asks for them. The agent will invoke a backend Autolaunched
Flow that queries the Case object using the provided Case Number.
- Name: Get Case Details
- Classification Description: This
topic is used to get Case details by invoking a Flow in the backend using
Case Number.
Step-by-Step Instructions
Instruction 1: Trigger the Topic
The topic should activate when the user
asks for case details.
Instruction 2: Detect User Intent
Configure the topic to recognize phrases
like:
- “Show case details”
- “Get details for case number 12345”
- “Provide case information”
Instruction 3: Validate Case Number
Ensure the user provides a Case Number. If
missing, prompt:
“Please provide the case number to retrieve
details.”
Instruction 4: Invoke the Action
Create an Action in Agentforce:
- Action Name: Get Case Details
- Action Type: Flow
- Flow: Autolaunched Flow that
accepts Case Number as input
- Pass the Case Number from the topic to the flow input variable.
Instruction 5: Handle Errors Gracefully
If the action fails, display:
“We encountered an issue while fetching
case details. Please try again later.”
Instruction 6: Display Case Information
Display case information.
Action Associated to a Topic:
Flow Details:
This flow is taking caseNumber as an input using Variable as highlighted in image
And the using get Record getting the case
details and finally returning the case record to agentforce agent.
Agentforce Agent Unit Testing:
Note: Autolaunched don’t require manual user access i.e we do not explicitly need to give service agent access to flow.
No comments:
Post a Comment