Custom Agent Action in Agentforce Using Salesforce Flow : Shubham

Custom Agent Action in Agentforce Using Salesforce Flow
by: Shubham
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of Custom Agent Actions in Salesforce Agentforce In Salesforce Agentforce, when a new agent is created, it can understand user queries, perform tasks, and provide responses. This tutorial focuses on creating custom actions using Salesforce Flow, which allows agents to automate specific tasks based on organizational needs. **Key Details:** 1. **Custom Actions**: These are tailored functions that can be created to address specific tasks within an organization, such as creating draft orders or booking appointments. They can be built using various methods, including: - **Apex**: Salesforce's programming language. - **Flows**: A no-code automation tool. - **Prompt Templates**: Predefined prompts in natural language. - **External Services**: Connections to external APIs without coding. 2. **Creating Custom Actions**: - **Auto-Launched Flow**: This is a type of flow that can be set up to automate tasks. For example, you can create a flow that automatically generates a task record when prompted. - **Steps to Create a Flow**: - Navigate to Setup and create a new Auto-Launched Flow. - Define variables for input and output, and set up the task creation process. - Ensure the flow is activated before using it as a custom action. 3. **Assigning Actions to Agents**: - After creating a custom action, it can be assigned to agents like the Einstein Copilot. - The process involves selecting the agent in Setup, navigating to the actions section, and adding the new custom action. 4. **Conclusion**: The tutorial emphasizes the importance of custom actions in enhancing the functionality of agents in Salesforce Agentforce, allowing for efficient task automation based on user prompts. ### Additional Context Understanding how to create and assign custom actions can significantly improve the efficiency of agents within Salesforce. This feature is particularly useful for organizations looking to streamline their operations and enhance user interactions with their AI-driven agents. ### Relevant Hashtags for SEO #Salesforce #Agentforce #CustomActions #SalesforceFlow #Automation #Apex #NoCode #CRM #AI #BusinessAutomation #SalesforceTutorials #EinsteinCopilot


After creating a new agent in Salesforce Agentforce, when a user asks a query or question, the agent understands and processes the information, takes action to perform tasks, and responds to the user.

These actions enable agents to process queries and provide accurate responses. There are different ways to create custom actions in Agentforce.

In this tutorial, we will learn how to create a custom agent action in Agentforce using Salesforce Flow. In this, I will use the use case to explain what a custom action is and, after creating custom actions, how to assign them to agents in Salesforce.

Custom Actions in Salesforce Agentforce

The work behind the scenes of an agent is because of actions. Actions actually perform the task, such as creating a draft order, booking an Appointment, or fetching record details.

We will create both standard and custom actions in the system according to the organization’s needs, each addressing a specific task. Custom actions can be made using Flows, Apex, and prompt templates.

  • Standard Actions: When we enable the agent, the actions already provided by Salesforce are standard.
  • Custom Action: Salesforce users create custom actions according to business needs to solve tasks specific to the organization.

The following are ways to create custom actions in Salesforce:

  1. Apex: Salesforce programming language.
  2. Flows: No code Salesforce automation tool.
  3. Prompt Template: Reusable prompts written with natural language.
  4. External Services: No-code connection to external API.

Custom Agent Action in Agentforce Using Salesforce Flow

In the step below, I have created a custom action using a Salesforce flow so that when agents need automation, the flow can be used as a custom action.

So, let’s take a scenario to create a custom action in Agentforce. The agent has to manually create a task or activity record on an account or any other standard or custom object.

Since users work on multiple accounts, this involves a lot of clicks for them, so it would be very convenient if their AI assistant could automate this process for them. For that, let’s create a custom action using the flow.

Important: We can only use invokable or auto launched flows to create the custom action to assign to and agents in Agentforce.

1. Create Auto-Launched Flow

  1. Navigate to Setup -> In Quick Find, search for Flows -> Click New Flow button -> Select Auto-launched Flow-> Click Create button.
Agentforce Custom Actions Using Salesforce Flow
  1. Here, I created three text variable resources: RelatedIdSubject, which is available for input, and TaskId, which is kept available for output. In the step below, I have shown an image to create the variable.
Create Agentforce Custom Actions Using Salesforce Flow
  1. Here, you can see that I created a Variable with ‘Text’ as the data type, set it to be available for input, and clicked the ‘Done‘ button.
Agentforce Custom Agent Action using Salesforce Flow
  1. Then, to assign the task to the record owner, we need to add the Create Record element. Provide details; in the object, select the Task object. Below, I have explained Set Field Values for the Task:
  • Due Date Only: For the due date, I have assigned a formula that sets the due date to be within the next 3 days after the task is assigned.
  • Assigned To ID: Here, we need to specify to whom we want to assign this task, and I assigned it to the current user.
  • Subject: The subject will be whatever he has sent, and the related ID will become the whatId
Create Agentforce Custom Actions Using Salesforce Flows
  1. After that, we set the TaskId variable to be available for output, added it here, and stored the ID of the created task record. That means it will be displayed as an output field on the custom action.
How to Assign Flow Custom Actions to Agents in Salesforce

After creating the flow, save it and ensure it is activated before using it as a custom agent action in Salesforce Agentforce.

2. Create a Custom Action Using Flow in Agentforce

Now, we will create a new Agent custom action so that when the user asks any query or question, the agent takes action to perform tasks and responds to the user.

  1. For that, go to Setup. In the Quick Find, search for Agent Action. Click on New Agent Action.
Create Agentforce Agent Action in Salesforce
  1. Fill in the details below:
  • Referenced Action Type: Previously, we selected Apex; now, as we are creating actions using flows, we need to choose Flow.
  • Referenced Action: Here, select the label you provided in the auto-launched flow we created.
  • Then, the Agent Action Label and API Name will automatically populate.
Custom Agent Action in Agentforce Using Salesforce Flow
  1. So here, we need to provide instructions to the agent. In Agent Action Instruction, I have provided instructions to the agent so that whenever the agent gets such a prompt.
    • It will be easy for the agent to understand that this action will solve the same requirement.
    • Again, we have an input field and an output field. Here, too, we must provide the instructions. Then click the Finish button.
Create Custom Agent Action in Salesforce Flow
  1. As you click the finish button, you can see that the Agent custom action has been successfully created.
How to Create Custom Agent Action in Salesforce Flow

3. Assign Action to Agent in Salesforce

In the steps below, I will assign the custom action to the Einstein Copilot agent that we created using the screen flow to create a task when the agent gets such a prompt.

    1. Before assigning the action to an agent, let’s ask the agent to create a task record for a particular account with a subject. Below the image, you can see the prompt response to the ‘search query isn’t supported’.
    Salesforce Flow Create Agent Actions in Agentforce
    1. Now, let’s assign the created custom action to an agent. For that, navigate to the Setup -> In Quick Find, search for the Agents -> Select the Agent for which you want to assign a custom action.
      • Here, I have selected Einstein Copilot, which is Agentforce. -> Then click on the Open in Builder button to add an action.
      • After that, select the Topic to which you want to add the custom action. Then click This Topic’s Actions tab, click the New button, and select the Add from Asset Library option to choose the action that we created.
    Create Salesforce Flow Agent Actions in Agentforce
    1. Then, select the action you want to assign to this agent. You can also select multiple actions, including standard and custom actions. Then click the Finish button.
    Agentforce Agent Custom Actions in Salesforce
    1. After assigning the custom action to the agent, I again asked the agent to create a task for the XYZ account with the subject ABC. You can see how the agent responded to a task created with the provided details.
    Create Agentforce Agent Custom Actions in Salesforce
    1. Additionally, as I navigate to the Task object, a new record has been created with the values we provided in the prompt and the auto-launched flow.
    Create Agentforce Agent Custom Action in Salesforce

    In this way, we can create custom actions using flow for Agentforce in Salesforce to automate any task when the agent gets such a prompt.

    Conclusion

    I hope you have an idea about how to create custom actions using the flow for Agentforce in Salesforce. Using the use case, I have explained what a custom action is, which flow supports creating custom agent actions, how to create a flow, how to create a new action, and how to assign custom actions to agents in Salesforce after they have been created.

    You may like to read:

    The post Custom Agent Action in Agentforce Using Salesforce Flow appeared first on SalesForce FAQs.


    September 18, 2025 at 11:07PM
    Click here for more details...

    =============================
    The original post is available in SalesForce FAQs by Shubham
    this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
    The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
    ============================

    Salesforce