Our company uses a custom object called “Project__c” to manage client projects. We want to send a “Project Completion Email” to the client upon project completion.
However, we do not want to send this email automatically for every project. If we create a record-triggered flow, it will send an email every time a project is marked as completed, even if the team is not yet ready to notify the client.
To avoid this, we decided to launch the “Send Project Completion Email” flow from a button on the project record page. This way, the team can review the project first and send the email to the client only when they are ready by clicking the button.
In this article, we will learn about how to launch Salesforce flows using buttons. I will explain how to create a flow and add to the button so that whenever the user clicks the button, the email will be sent to the client.
How to Launch Salesforce Flows Using Buttons
Since we cannot add an autolaunch flow directly to a button, we need to use the autolaunch flow as a subflow within the screen flow.
First, I will explain how to create an auto-launch flow to send an email to the client upon project completion. Then, using screen flow, we can trigger the auto-launched flow from a button.
Create an Autolaunched Flow to Send Email in Salesforce
To create the flow, go to Setup -> in Quick Find search for ‘Flows‘ -> click the New Flow button -> select Start From Scratch -> Autolaunch Flow(No Trigger) -> Create.
First, we need to create a recordId resource variable so that we can take input from the record ID to pass the flow. Then the flow will automate the process for that record.
As you click the Resource Type dropdown field, you will see various resources, such as Variable and Text Template. Here we need to select the Variable.
Now we need to provide the details for the following fields:
- API Name: Ensure that the variable name must be exactly recordId to assign the record ID from the object.
- Data Type: The record ID is always a text string, so set the data type to Text.
- Availability Outside the Flow: We must check the Available for input option.
Then click the Done button.

Next, we need to retrieve the project records stored in the Project__c object. For that, we need to add the Get Records element and enter a Label and API Name.
We will send an email to the client from the record page, where we will add a button so that the client’s email will get sent.
That means we only need to retrieve the open record ID. For that, we need to add a filter condition as follows:
- Record ID (project) equal to ‘recordId’ (a created variable).
Now, the ‘recordId‘ variable will be passed into the Screen Flow. So that flow will know which record is being created or updated.

After that, if you want to use dynamic subject and body for email, then we need to create a Text Template resource.
Below, I have created a text template for the email subject.

Again, create a text template for the email body.

Now, add the Send Email element so that when we click the button, the email will get sent to the client.
Here, you need to select the field values to send an email, such as the recipient address, sender email, subject, body, etc.
In the subject and body, we need to select the text templates we created.

Then, we update the completion email send field set to true, so the account owner will be notified that this client project completion email has been sent.

Now we are ready to save the flow. For that, click the Save button, provide the flow Label, and the API Name will be automatically populated.

After that, always debug the flow before activating it to ensure that the working flow is correct and that there are no runtime errors. Then activate the flow.

Create a Screen Flow to Call an Autolaunched Flow in Salesforce
Now we know that the autolaunch flow cannot execute automatically, and we cannot add it to the button.
For that, we will call the autolaunch flow from the screen flow a subflow and then add the screen flow to the button.
To create the flow, navigate to Setup -> in Quick Find search for Flow -> New Flow -> Start From Scratch -> Screen Flow -> Next.
Here, we also need to create a Variable resource with the name recordId, so that we can retrieve the record ID from the open record page and then pass it to the autolaunch flow for further processing.
Then, click the Add Element icon and select the Subflow under the Interaction option.
In the Referenced Flow option, select the Auto-Launched flow you created in the above steps.
Then, in the Set Input Values Fields, we need to pass the recordId from the autolaunch flow to the screen flow variable we created first in the screen flow.
Then click on the Done button.

After that, add the screen element to display the success message when the email gets sent (optional).

Now save the screen flow and activate it.

Add Flow to Button in Salesforce:
Now, we will add the screen flow to the button, and then the button will be added to the project record page.
This way, whenever we want to send an email to the client, we can click the button, and it will trigger the auto-launch flow to send an email.
Navigate to the object manager and open the object on which you want to add the button.
There, we can see options for Buttons, Links, and Actions. Now, we will click on ‘New Action’ to add a flow to the Button.

Now we need to provide details to the button that we are going to create.
- Object Name: It will display the object name for which we are creating the button.
- Action Type: To create an action on the flow, select the Flow option in this field using the drop-down arrow.
- Flow: In this field, we can select which flow we want to call when the button click event occurs. Only activated flows will appear here.
- Label: We can customize the labels according to our requirements. This Label will display on the button.
- Change Icon: We can change the icon of the button.
Then click on the Save button.

Then, we need to add this Button to the Page Layout to display to record page.
To do that, click on Page Layout and open it in edit mode. Then, drag and drop the button to the layout.

Proof of Concept [Launch Flow From Button]:
Now, navigate to the object where you added the button. You can see the last modified date of the project record, at which time I have marked the project status as ‘Completed’.
If we use the record trigger flow, the email will be sent to the client immediately after the record is updated.
However, now that we use the autolaunched flow, when we click the Send Email button, the email will be sent to the client.
You can see the system date and time at the time I clicked the Send Email button. Now, let’s see the received email to the client.

After that, you will see a screen with a confirmation message, which is an optional screen. If you don’t want to add it, you can skip this step in the screen flow.

Now, as I checked the client’s email address, I found that they received the email at the time I clicked the send email button.
That means we launch the flow from the button on the record page.

In this way, we can call the flow from a button in Salesforce.
Conclusion
I hope you have got an idea about how to launch Salesforce flows using buttons. I have explained how to create a flow and add to the button so that whenever the user clicks the button, the email will be sent to the client.
You may like to read:
- How to Clone Salesforce Flows
- Use In and Not In Operators in Salesforce Flow
- Send An Email with Dynamic Attachments in Salesforce Flow
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.