Superbadge: Advanced Flow for Agentforce
Implement custom solutions using flow-powered agent actions in Agentforce.
Superbadge: Advanced Flow for Agentforce
Ce que vous devez accomplir pour gagner ce superbadge
- Create an AI agent.
- Customize a standard Agentforce topic and flow-powered action to deliver additional value.
- Create new topics and actions to manage a flow-based returns process with appropriate employee and agent engagement.
- Create a Prompt Template and pass data between the template, flows, and the agent.
Concepts testés avec ce Superbadge
- Creating and configuring an AI agent to work with different types of flows
- Working with custom and standard Agent Topics and Actions and the flows that power them
- Refactoring and creating flows so they are usable by an agent
- Configuring appropriate access to objects, fields, and content for agent interaction
Prework and Notes
Sign Up for a Developer Edition Org with Special Configuration
To complete this superbadge, you need a special Developer Edition org that contains special configuration and sample data. Note that this Developer Edition org is designed to work with the challenges in this superbadge.
-
Sign up for a free Developer Edition org with special configuration.
Fill out the form. For Email address, enter an active email address.
- After you fill out the form, click Sign me up.
When you receive the activation email (this might take a few minutes), open it and click Verify Account.
Complete your registration by setting your password and challenge question. Tip: Save your username, password, and login URL in a secure place—such as a password manager—for easy access later.
You are logged in to your superbadge Developer Edition org.
Now, connect your new Developer Edition org to Trailhead.
Make sure you’re logged in to your Trailhead account.
In the Challenge section at the bottom of this page, select Connect Org from the picklist.
On the login screen, enter the username and password for the Developer Edition org you just set up.
On the Allow Access? page, click Allow.
On the Want to connect this org for hands-on challenges? page, click Yes! Save it. You are redirected back to the Challenge page and ready to use your new Developer Edition org to earn this superbadge.
Now that you have a Salesforce org with special configuration for this superbadge, you’re good to go.
Use Case
Capricorn Coffee has built a thriving business delivering premium small-batch coffee and curated brewing gear, paired with outstanding service powered by Salesforce. With its subscription model growing steadily and seasonal promotions bringing new waves of customers, the company is preparing for sustained, long-term growth across digital sales channels and customer support.
To scale support operations without sacrificing the personalized service the brand is known for, Capricorn is implementing Agentforce to automate routine service tasks. Its Salesforce admin, Stan Kowalski, quickly realized that Capricorn’s existing flows, while great for employees, aren't quite ready for AI teammates.
Business Requirements
You’re stepping into the role of advanced Agentforce admin for Capricorn Coffee. Your job is to evaluate, create, and refactor automations so AI agents can securely and reliably support customers at scale. AI agents need to handle routine service tasks while maintaining performance, security, and customer trust. Use automation, agent configuration, and error-handling best practices to build a scalable solution that prepares Capricorn Coffee for long-term success with AI-powered service.
Create Agent Esso
Your first task is to set up a new agent. “Esso” (a term of endearment referencing Capricorn’s favorite espresso offering) will represent Capricorn’s AI-powered support. To complete this challenge, activate the required features and build agent Esso from the ground up. When you’re done, Esso should be ready to help customers and grow along with the business.Set Up the Agent
Enable Einstein and Agentforce, then create agent Esso by using the Create from a Template option and selecting Agentforce Service Agent. Use the following specifications to configure Esso.
- Deselect all of the topics that are automatically added
- Name:
Essowith API Name: Esso - Description:
You are an AI Agent whose job is to help customers with their orders, equipment issues, and product recommendations at Capricorn Coffee. - Role:
You are an AI Agent whose job is to help customers with their orders, equipment issues, and product recommendations at Capricorn Coffee. - Company:
Capricorn Coffee has been delighting customers with premium small-batch coffee beans, brewing equipment, and curated accessories for more than a decade. - Agent User: New Agent User
- Leave 'Keep a record of conversations with enhanced event logs to review agent behavior' unselected
- Don’t select any data sources
Remove any topics suggested in or created by the agent setup process.
Stan has already done a lot of the prework for setting up Agentforce, including a Messaging Channel named Capricorn Comms with Omni-Channel Routing, a queue called Agentforce Fall Back, and an Embedded Service Deployment called Agent Message for Messaging for Web Deployment. Complete the remaining steps to get Agentforce fully deployed in your org.
- Make sure the system is configured to send system emails with an org-wide email address.
- Review the Embedded Service Deployment.
- Review the permission set named Esso Permissions, which was created when Esso came online.
- Add the necessary permissions to the Esso Permissions permission set so Esso can send emails, run flows, and access Conversation Entries.
- Check for any other configuration Esso needs to successfully send emails as a user in the system.
Now that you’ve configured agent Esso, you’re ready to move on to the next challenge to flex your advanced flow and Agentforce skills. Get ready!
Configure Customer Verification for AI Interactions
With AI agents now engaging customers directly, Capricorn Coffee needs to ensure sensitive information like subscription details, order history, or payment information is only shared after identity is verified. You’ve been asked to strengthen security at the outset of every agent interaction by making sure the agent verifies customer identity before sharing account details or processing any changes. As part of that setup, you'll implement and modify a prebuilt customer verification topic that uses a two-step process. One agent action sends a one-time code to the customer’s email and another checks whether the code matches. If it matches, the agent continues. If not, the customer is asked to try again.Work with a Flow That Verifies Customers and Updates Contact Records
Start by creating a field on the Contact object calledLast Customer Verification with a data type of Date, with any meaningful description you’d like. The agent needs to interact with this field by updating its value during the verification process.
Next, begin configuring Esso’s topics and actions. Add the standard Customer Verification topic. Create a new version of the topic and review your version of the topic for further customization. The existing action Send Email with Verification Code works fine for Capricorn’s purposes, so you don’t need to make any changes to it.
The other action included in this topic is Verify Customer. You use this as a starting point for a new flow that expands the customer verification process, such as updating the Last Customer Verification field on the customer’s contact record. Save the Verify Code flow as a new flow with Label Verify Code and Log Verification and Description Compares the user-provided verification code and the emailed verification code that were both passed into the flow. Returns true if the codes match.
Part of the flow is already constructed to support the verification process. Don’t make any changes to the Verify Customer Code action, the Do Codes Match? Decision element, or the No(Default) decision path.
The flow follows the Yes path when the customer verifies the code as expected. Since orders are only associated with Contact records, add a Decision element prior to the existing "Set Verified to True" Assignment element with the following configuration to ensure that Esso only verifies customer email addresses. Label the element Is the Customer a User or Contact? with Description Evaluates the customerType variable to see if the customer is a user or contact, so the flow only updates contacts. Allow for two outcomes: one for User with a filter to check if customerType is equal to the text User and the default outcome with Label Contact.
Arrange the existing Set Verified to True element so that it’s the first element in the Contact branch of the "Is the Customer a User or Contact?" decision. Next, add an Update Records element in the Contact branch following the Set Verified to True element to update the contact record the flow is handling, using the following specifications.
- Label:
Update Contact's Last Customer Verification - Description:
Updates the verified customer's contact record with today's date in the Last Customer Verification field. - Filter condition: Contact ID set to Equals with value customerId
- Set field values for the Last Customer Verification field with the flow’s current date.
If the system doesn't find a contact email address, it will follow the User decision path. Create an element for the User path that will provide a message asking a user-customer to provide a contact email address. This element will set a variable value with a value provided by a new constant you create. Label the Assignment element Provide Contact Email instead of User Email with Description We found that email address for a user record. Please provide an email address for a customer Contact record so that we can help with your orders. Use a variable and constant to deliver the message if the verification attempt relates to a user email address.
- Variable Resource for message
- API Name:
messageAfterVerificationIfUser - Description:
Message displayed to the end user if verification process is complete but customerType is User not a Contact. - Constant Resource for message
- API Name:
notContact - Description:
Message displayed when customerType is User not a Contact - Value:
You're trying to validate a user record. Please provide the email address related to your Contact to validate.
Create a Topic Action for Esso to Verify and Update Contact Records
To associate the new flow with Esso, create a new Topic Action. Review the existing Verify Customer Agent Action before removing it from the topic. Create a new Agent Action that references the flow you just configured, using any Loading Text you'd like. Because this Agent Topic was created from the asset library, we can’t check for its Agent Actions directly. We’ve provided a reference with additional configuration notes for you in the Help article for this superbadge.
Refactor a Flow for Agentforce Compatibility
Capricorn Coffee's current process for handling refunds uses a button on the Order record that kicks off a screen flow, which works well for the customer service team. But AI agents can’t interact with buttons or screens like humans can.To complete this challenge, you'll refactor the Refund Flow so it can be called by an agent, including adding a decision logic and a fault path if something goes wrong. The Agentforce-friendly version of the flow will create records in a new custom object called Refund Request instead of issuing refunds directly.
Adapt a Flow to Support Agent Esso
As you review the existing autolaunched Refund Flow that was used in the screen flow, you see several elements that you can use to make it Agentforce-friendly. Although some changes are needed since the action will be triggered by an agent instead of a record, you can still use the elements that get the current order and order line items. Save the flow as a new flow named Refund Request Flow with description This Autolaunched flow supports the refund process for agents by automating refund requests based on original order details.
First up for review: the Get Current Order element. Rather than using a record ID passed by a screen flow launched from an Order record, filter records based on Order Number using the variable orderNumber. Add a second filter condition that makes sure the order in question is associated with the current customer by creating a variable verifiedContactID with Description Receives the ID of the contact we have verified who is interacting with the Agent. Use this variable to be equal to the field Customer Authorized By Id.
Next, review the Get Order Line Item element. No changes are needed in the first filter condition for Order ID. For the second filter condition, filter records based on Product Name rather than using a record ID, with the variable productName.
Add a Decision element following the Get Order Line Item element with Label Did we find a matching order and line item? and Description Identify whether a matching order and line item were found, based on the customer’s input in the messaging session. Configure three outcomes to enable the agent to help customers in three different conditions: if they provide their order and item, if they provide their order but don't know the item, and finally if they don't provide their order number or the item.
Yes, found order + line itemwith two conditions: The Order ID from the Get Current Order element is found (is not null) and the Order Product ID from the Get Order Line Item element is found (is not null)Found only order, no line itemwith two conditions: The Order ID from the Get Current Order element is found (is not null) and the Order Product ID from the Get Order Line Item element is not found (is null)Found no order (or line item)
Complete the following configuration for the first outcome (when the order and line item(s) are found). Move the existing Create Refund Order element into this outcome with a new Label and API Name. Use the Label Create Refund Request and make sure the API name is updated to Create_Refund_Request. Update the Description to Gets information about the order the customer is requesting a refund for, gets order details, and uses those details to create a Refund Request record. This element should create a
- Order populated by the ID associated with the current order ID
- Account populated by the Account ID associated with the current order
- Amount populated by the total price of the order line item
- Comments populated by the refundReason variable
- Date populated by the flow’s Current Date
- Refund Request Name populated by the refundRequestName variable
As a backup, add a fault path to the Create Records element that creates a case if anything goes wrong with Refund Request records forming. Name the element Create Case with Description Creates a case in the event of any issues preventing the successful formation of a Refund Request record. Set field values for the case record as follows.
- Contact ID populated by the verifiedContactID variable
- Description populated by a new resource that can hold rich text
- API Name
caseDescription - Description
Provides text for the description field on a case in the event of any issues preventing the successful formation of a Refund Request record. - Body text
There was an error in the flow creating a Refund Request Record for Contact related here.
Order Number: {!Get_Current_Order.OrderNumber}
Order Product Name: {!Get_Order_Line_Item.Product_Name__c}
Fault Message: {!$Flow.FaultMessage}
Please investigate. - Status with a value of New
- Subject
Error Creating Refund Request
Since the agent will be interacting with the flow, you next remove any elements that won't be used. Delete the Put Refund Id into Variable element.
Adjust the existing Get Newly Created Refund Order element to follow after the Create Refund Request element, updating the Label and the API Name. Use the Label Get Newly Created Refund Request and update the API Name to Get_Newly_Created_Refund_Request with Description Gets the recently created Refund Request to summarize as an output back to the customer acknowledging the request has been created. Add a filter condition based on the Refund Request record ID being equal to the record created from the Create Refund Request action. Store the Refund Request in the variable refundRequestOut, storing the following fields: Id, Amount__c, Order__c, Comments__c, and Name.
For the second outcome, Found only order, no line item create a Get Records element with Label Get Order Line Items on Found Order and Description Return products from an order, when a customer provides an order number but not a product name. This element should get Order Product records where the OrderID equals the current order ID. Use the orderProducts variable to store multiple Order Product records and set the values for the Id, Product_Name__c, and OrderItemNumber fields.
For the third outcome, Found no order (or line item), configure a Get Records element with Label Get This Contact's Orders and Description Return the customer’s most recent orders when a customer doesn't provide an order number. Include the following configuration.
- Return Order records in which the CustomerAuthorizedById equals the verifiedContactID.
- Return up to five records in descending order by the date they were created.
- Create a variable to hold several records called
customersOrderswith DescriptionReturns the 5 most recent orders made by the customer. Be sure to list their names, numbers, and order dates to the customer in the case that the customer doesn't know their order number.
Set the values for fields stored in customersOrders for the Id, CreatedDate, Name, and OrderNumber fields.
Finally, clean up the flow by removing any elements that are no longer used, including recordId, productId, and refundNumber. Deleting these elements will provide a better experience for Esso.
Before proceeding, we recommend debugging the flow using Order 00000100 or with test records of your own (but we won’t check for that). You can update the contact record for Aaron Sierra with your email address to debug the flow with your own user and as agent Esso.
Create an Agent Action for the Refund Request Process
Use this newly created flow in a new Topic for Esso called Refund Process with the following configuration.
- Classification Description:
Guide customers through the refund request procedures, including initiating the process automatically when a product is reported as damaged or unsatisfactory. - Scope:
Your job is to guide customers through the process of requesting a refund and to create a refund request record. You are not able to issue the refund directly but request it and have one of the customer service agents review the request and issue the refund. - Instruction:
If a customer expresses the desire to return a product, request the order number and product name and create a Refund Request record and inform the customer of the Refund Request details and that a customer service agent will review the request. - Instruction:
If a user does not provide their order details, ask if they would like to look up their order history using their email address or order ID. Do not ask for a username. - Instruction:
When a customer requests a refund or reports that their product is damaged or unsatisfactory, let them know you are there to help. Run the Refund_Request_Flow action and collect all of the necessary information. and finally, summarize everything that has been done. - Instruction:
Ensure that a refund request record is created immediately after the customer provides the necessary details and inform the customer of the Refund Request name (do not provide the Refund Request record ID).
Create a new Agent Action using the Refund Request Flow, which will populate the Agent Action Label Refund Request Flow. The Agent Action Instructions This Autolaunched flow supports the refund process for agents by automating refund requests based on original order details will populate from the flow's configuration. You can use any loading text you'd like. Although we can't check for it, you can use the Input and Output Configuration provided in the Help article for this superbadge to complete the Agent Action configuration.
Implement Customer Sentiment-Based Actions
Capricorn’s brand is built on exceptional service, and the company wants to carry that standard into their AI-powered experiences. By understanding how customers feel after interacting with an agent and responding in a personalized way, Capricorn can increase retention, discover any issues quickly, and reinforce trust. Depending on the interaction, they might send the customer a discount code as a thank-you or goodwill gesture.
You’ve been asked to design a process that evaluates how the customer felt about their conversation with the AI agent, then takes action based on that feedback.
As part of your configuration:- Create a prompt template to summarize entire messaging session records and extract the customer sentiment.
- Create a new flow that will run the prompt template, interpret the result, and return a clear action recommendation or system update.
- Call the flow in an Agentforce action to provide a discount voucher based on the customer’s sentiment.
Create a Messaging Session Conversation Flow
Create a flow that can be triggered from a prompt template to summarize Messaging Session records. In the initial configuration, select a prompt template type Record Summary Template Capability to use this flow with Record Summary prompt templates. Save the flow with the Label Send Esso Messaging Session Transcript and Description Gets the transcript for a messaging session and sends the transcript to the associated prompt template as prompt instructions.
Add a Get Conversation Transcript for Record Action to get the conversation transcript for a record. Use the Label Get Conversation Transcript and Description Calls an action to get the conversation transcript associated with the messaging session passed into the flow as part of the prompt template input. Stores the results in Outputs from Get_Conversation_Transcript. For the record summary input, use the Messaging Session ID from the Prompt Template Input.
Next, configure an Add Prompt Instructions element with the Label Add Conversation Transcript to Prompt Instructions and Description Adds the conversationTranscript property of Outputs from Get_Conversation_Transcript to the prompt instructions. Use the prompt instructions from the previous Action that retrieved the conversation transcript.
Create a Prompt Template that Summarizes a Messaging Session
Create a prompt template that summarizes records called Summarize Esso Messaging Session. Include the template description Analyzes a messaging session between a customer and an agent to determine if the customer's experience was positive, negative, or neutral. You can use any model type and model you’d like.
Include the following as the prompt text, replacing the text in brackets with the appropriate resources.
You are an analyst, your job is to summarize customer sentiments from transcripts coming from [the messaging session record snapshot] after the conversation ends.
When I ask you to summarize data from a given transcript, you must strictly follow my instructions below.
Instructions:
""
Customer Sentiment: Generate the sentiment of the customer from the conversation: [the flow you built to get the transcript for a messaging session]. It can be either: Positive, Negative or Neutral.
Don't say sentences like 'The customer sentiment from the conversation is'
""
Create a Flow that Identifies Customer Sentiment
Create a flow that Esso can interact with called Customer Sentiment Handler with Description Reviews customer sentiment based on Messaging Session content, to determine if a customer's experience with an agent was satisfactory, unsatisfactory, or neutral.
Create a Get Records element Get Messaging Session with Description Find the Messaging Session of the current Agent interaction with the User. This element should get the current Messaging Session record with a condition that the Messaging Session ID is equal to a new variable messagingSessionId with Description This variable stores the messaging session ID.
Add an Action that calls the Prompt Template Summarize Esso Messaging Session with Label Summarize Conversation and Description Summarize the messaging conversation to get customer sentiment. This action should summarize the entire messaging session from the prior element. Store Output Values in a new variable called customerSentiment with the Description Holds customer sentiment based on the response from the prompt template.
Create a Customer Sentiment Analysis Topic
Use this newly created flow in a new Topic for Esso called Customer Sentiment Analysis. Include the following configuration.
- Classification Description:
Provide appropriate voucher codes based on customer sentiment after creating a refund request record. - Scope:
Your job is only to perform customer sentiment analysis at the end of the conversation and provide appropriate voucher codes based on the summarized sentiment. - Instruction:
After summarizing the refund request and creating a refund request record, call the Customer_Sentiment_Handler action to perform customer sentiment analysis. - Instruction:
Provide '50OFF' voucher code if the customer sentiments are Negative. Provide '25OFF' voucher code if the customer sentiments are Neutral. Provide '15OFF' voucher code if the customer sentiments are Positive.
Create a new Agent Action using the Customer Sentiment Handler flow with Agent Action Label Customer Sentiment Handler. The Agent Action Instructions will populate from the flow's configuration. You can use any loading text you'd like. Although we can't check for it, you can use the Input and Output Configuration provided in the Help article for this superbadge to complete the Agent Action configuration.
Agentforce Applications
You’ve configured Esso to support Capricorn’s service team, but the work you’ve done here has the possibility to extend far beyond one agent. Every flow, permission set, and configuration you’ve chosen has the potential to become a template—something other teams can adapt and build on, without starting from scratch.
Think about your own org:
- Where could flows like these be useful, with small adjustments?
- What configuration and documentation practices would make them easier to adopt in service, sales, or operations?
- What’s the best way to manage access levels without repeating work across roles or teams?
Use what you’ve built here to spark conversations. What other processes are ready for this kind of scale? Where else could an ai agent make an impact?
This process isn’t just about building one great solution, it’s about creating systems that are resilient, adaptable, and trusted by both your teams and your customers.




