Create Custom Action Using Flow For Agentforce in Salesforce : Bijay Kumar
by: Bijay Kumar
blow post content copied from SalesForce FAQs
click here to view original post
### Summary of Creating Custom Actions in Salesforce Agentforce In Salesforce Agentforce, after setting up a new agent, users can interact with the agent by asking questions. The agent processes these queries and performs tasks to provide accurate responses. This tutorial focuses on creating custom actions using Salesforce Flow, which allows agents to automate tasks based on specific business needs. #### Key Details: 1. **Custom Actions**: These are tailored actions created by Salesforce users to meet specific organizational tasks, such as creating draft orders or booking appointments. 2. **Types of Actions**: - **Standard Actions**: Predefined actions provided by Salesforce. - **Custom Actions**: User-defined actions created using tools like Apex, Flows, and prompt templates. 3. **Creating Custom Actions**: - **Using Flow**: A no-code automation tool in Salesforce. - **Steps to Create a Custom Action**: 1. Create an Auto Launched Flow to automate task creation. 2. Define variables for task details (e.g., subject, due date). 3. Use the Create Record element to set up the task. 4. Save and activate the flow. 4. **Assigning Actions to Agents**: After creating a custom action, it can be assigned to agents in Salesforce, allowing them to perform tasks automatically when prompted by users. #### Additional Context: - **Automation Benefits**: Custom actions streamline processes, reducing the number of clicks needed for agents to perform repetitive tasks. - **Use Case Example**: An agent can automatically create a task for an account based on user input, enhancing efficiency and response time. ### Conclusion This guide provides a clear understanding of how to create and assign custom actions in Salesforce Agentforce using Flow. By automating tasks, organizations can improve their operational efficiency and enhance user experience. ### Relevant Hashtags for SEO: #Salesforce #Agentforce #CustomActions #SalesforceFlow #Automation #CRM #SalesforceTutorial #BusinessEfficiency #NoCode #SalesforceDevelopment
After creating a New Agent in Salesforce Agentforce, when a user asks a query or question to an agent, the agents understand and processes information, takes action to perform tasks, and responds to the user. These actions help agents process the query and give correct responses.
There are different ways to create custom actions in Agentforce. In this tutorial, we will learn about how to create custom action using flow for Agentforce in Salesforce. In that, using the use case, I will 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 working behind the scenes of an agent is because of actions. Actions actually perform the task, like creating a draft order, booking an Appointment, fetching record details, etc.
We will create standard and custom actions in the system according to the organization’s needs, which will solve a particular task. The custom actions can be created using Flows, Apex, and prompt templates.
- Standard Actions: When we enable the agent, the actions already provided by the Salesforce are standard actions.
- Custom Action: Salesforce users create custom actions according to business needs to solve tasks specific to the organization.
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 connection to external API.
Create Custom Action Using Flow For Agentforce in Salesforce
In the below step, 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 becomes a lot of clicks for them, so it would be very easy if their AI assistant could do this 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:
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: RelatedeId, Subject, which is available for input, and TaskId, which is kept as 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 the 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 Task object. In the below, I have explained Set Field Values for the Task:
- Due Date Only: In the due date, I have assigned the formula where I set the due date as in the next 3 days when 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

After that, we set the TaskId variable as available for output, added that variable here, and stored the created task record ID. That means it will be shown on the custom action as an output field.

After creating the flow, save it and ensure it is Activated before using it as a custom agent action in Salesforce Agentforce.
2. Create Custom Action For 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.
For that, go to Setup. In the Quick Find, search for Agent Action. Click on New Agent Action.

Fill in the below details:
- Referenced Action Type: Previously, we selected Apex; now, as we are creating actions using flows, we need to select 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 the agent gets such a prompt, it will be easy for the agent to understand that this action will solve the exact same requirement.
Again, we have an input field and an output field. Here, also, we have to give the instructions. Then click the Finish button.
I have explained how to create an action in Agentforce.

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

3. Assign Action to Agent in Salesforce
In the below steps, 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 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 select the action that we created.

Then select the Action that 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 subject ABC. You can see how the agent responded to a task created with provided details.

Also, as I navigate to the Task object, the new record has been created with the values that we provided in the prompt and the auto-launched flow.

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 creating them.
You may like to read:
- Atlas Reasoning Engine in Salesforce Agentforce
- Einstein Trust Layer in Salesforce Agentforce
- Salesforce Employee and Service Agent in Agentforce
The post Create Custom Action Using Flow For Agentforce in Salesforce appeared first on SalesForce FAQs.
March 24, 2025 at 06:12PM
Click here for more details...
=============================
The original post is available in SalesForce FAQs by Bijay Kumar
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.
============================

Post a Comment