Agentforce in Salesforce is a powerful AI platform that helps businesses automate tasks, answer user queries, and perform real-time actions.
Instead of just replying like a chatbot, Agentforce agents can actually think, plan, and take actions automatically using your Salesforce data and workflows.
After creating a new agent in Salesforce Agentforce, when a user asks a question, the agent understands and processes the information, performs 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.
What is Agentforce in Salesforce?
Agentforce is an AI-powered platform in Salesforce that allows you to create intelligent agents that can:
- Understand user queries
- Analyze data
- Make decisions
- Perform actions automatically
These agents use data, reasoning, and actions together to complete tasks without human intervention.
For example, a customer asks: “Check my order status.”
The Agentforce agent can:
- Understand the request
- Fetch data from Salesforce
- Execute a process
- Return the result
What is an Agent Custom Action?
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.
An Agent Custom Action is a custom functionality you create and assign to an Agentforce agent so it can perform specific tasks. A custom action is a task or operation that an AI agent can perform automatically.
These actions act like the brain + hands of the agent, allowing it to interact with:
- Salesforce data
- Flows
- Apex logic
- APIs
According to Salesforce, actions are the building blocks that enable agents to perform tasks and interact with data.
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 to address business-specific tasks.
The following are ways to create custom actions in Salesforce:
- Apex: Salesforce programming language.
- Flows: No code Salesforce automation tool.
- Prompt Template: Reusable prompts written with natural language.
- External Services: No-code integration with external APIs.
Why Do We Need Custom Actions?
By default, Agentforce agents cannot do everything. They need instructions and capabilities. That’s where custom actions come in.
- Without Custom Actions:
- The agent can only respond with text
- Cannot perform real work
- With Custom Actions:
- An agent can create records
- Update data
- Trigger automation
- Call APIs
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 must manually create a task or activity record on an account or another standard or custom object.
Since users work across multiple accounts, this requires many clicks, so it would be very convenient if their AI assistant could automate this process. 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
- Navigate to Setup -> In Quick Find, search for Flows -> Click New Flow button -> Select Auto-launched Flow-> Click Create button.

- Here, I created three text variable resources: RelatedId, Subject (available for input), and TaskId (kept available for output). In the step below, I have shown an image to create the variable.

- 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.

- 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: I have assigned a formula that sets the due date to fall within the next 3 days after the task is assigned.
- Assigned To ID: Here, we specify to whom we want to assign the task; I assigned it to the current user.
- Subject: The subject will be whatever he has sent, and the related ID will become the whatId

- 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.

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 a question, the agent performs the requested task and responds to the user.
- For that, go to Setup. In the Quick Find, search for Agent Action. Click on New Agent Action.

- 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.

- So here, we need to provide instructions to the agent. In Agent Action Instruction, I have provided instructions to the agent so that whenever it receives 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.

- As you click the finish button, you can see that the Agent custom action has been successfully created.

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.
- 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’.

- 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 you want to add the custom action to. 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.

- 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.

- 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.

- 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.

In this way, we can create custom actions in Salesforce Flow for Agentforce to automate any task when the agent receives such a prompt.
Difference: Standard vs Custom Agentforce Agent Actions
| Feature | Standard Action | Custom Action |
|---|---|---|
| Pre-built | Yes | No |
| Custom Logic | Limited | Full |
| Flexibility | Low | High |
| Use Case | Basic tasks | Advanced automation |
Frequently Asked Questions
Q1: What is Agent Custom Action?
It is a custom task that an agent can perform automatically
Q2: Can we create an action using Flow?
Yes, Flow is the easiest way
Q3: Can we use Apex?
Yes, for advanced logic
Q4: Is coding required?
Not always
Q5: Where are actions used?
In Agentforce AI agents
Conclusion
I hope you have an idea about how to create custom actions using the flow for Agentforce in Salesforce.
Agent Custom Actions in Salesforce Agentforce are one of the most important features that make AI agents powerful and useful in real-world scenarios.
Instead of just responding to queries, these actions enable agents to perform real business operations, such as creating records, updating data, and integrating with external systems.
If you want to build smart AI solutions in Salesforce, learning how to create and use custom actions is essential. Start with Flow-based actions, practice real-time use cases, and then move to advanced Apex-based solutions.
You may like to read:
- Einstein Trust Layer in Salesforce Agentforce
- Salesforce Employee and Service Agent in Agentforce
- Create Agentforce-Enabled Scratch Orgs From Salesforce Developer Edition
- Agentforce for Developers in Salesforce
- Create Custom Actions Using Apex For Agentforce in Salesforce

Shubham is a Certified Salesforce Developer with technical skills for Building applications using custom objects, approval processes, validation rule salesforce flows, and UI customization. He is proficient in writing Apex classes, triggers, controllers, Apex Batches, and bulk load APIs. I am also familiar with Visualforce Pages and Lighting Web Components. Read more | LinkedIn Profile