In Salesforce, the flows are the most powerful automation tool provided by Salesforce. The platform event trigger flow launches when any platform event message is received.
In this Salesforce tutorial, we will learn about platform event triggered flow in Salesforce. In that, we will discuss the following points:
- What is platform event triggered flow in Salesforce?
- Example- Create platform event triggered flow in Salesforce.
What is Platform Event Triggered Flow in Salesforce
In Salesforce, the platform event-triggered flow is used to automate tasks or actions based on events that are occurring within the org. This auto-launched flow runs in the background. It starts executing when a specific event occurs.
Let’s understand the platform event concept and its execution in the flow:
- Platform Event: As the word Event, it means something happened in the Org. For example, new records were created, an error occurred, and any case was escalated.
- Flow: The flow takes the follow-up from the event that happened in the Org, and based on that, it performs further operations like creating a task, sending an email, or notification.
When any platform event occurs, the flow executes automatically, handles the event, and performs necessary actions without manual operation.
Example- Create Platform Event Triggered Flow in Salesforce
For example, while creating the records, users may encounter various errors and issues. It will be very difficult for an admin to identify all those problems and provide a solution at a particular time.
Now, we will discuss how we can use a platform event-triggered flow to resolve the issue and automate this process.
- Platform Event: A capture error occurred in the Org.
- Flow: Automate the process of sending the solution of that particular error to the users.
In this example, we need a Screen Flow so that when we get an error, a platform event will occur.
Create a Screen Flow in Salesforce
1. Go to the Setup -> In Quick Find Box, search for Flow -> New Flow -> Start From Scratch -> Next -> Click on the Screen Flow -> Create.
2. Add a Screen Element on the flow canvas. Add some fields in the screen element.
3. Then add the Create Record Element and map the screen element fields with Salesforce Object’s fields.
4. I have Saved this screen flow named Create an Account Screen Flows.
I have created screen flow to create an account object record, in which I have added the fields shown in the image below:

You can read the whole article on Screen Flow in Salesforce.
Firstly, we must have a custom object in order to capture the event in our flow.
Create Custom Object in Salesforce
The Platform Event catches the error. In this scenario, if there is an error in a screen flow, the platform event will catch it and store it in the object that we are going to create.
You can read the whole article on Create Custom Objects in Salesforce.
- Here, I have created a custom object named ‘Log a Error_c.’ In that object, I created two fields to store or display the Event Name and Error Message.
| Field Name | Value |
| Log a Error Name | Event Name |
| Descriptions | Error Message |

Create Platform Event Triggered Flow in Salesforce
Using the following steps, we can create the platform event trigger flow for Salesforce.
1. Go to the Setup -> In Quick Find Box, search for Flow -> New Flow -> Start From Scratch -> Next.

2. Now select the flow type. Click on the Platform Event-Triggered Flow -> Create.

3. As per our scenario, we have to select Flow Execution Error Event in the platform event option. This flow event notifies users when an error occurs.
- As per our example, whenever a screen flow fails, a platform event called a Flow Execution Error Event, that contains the error message and details.

4. Now, add the Create Records element so that we can store an error message in the created object. As you add the created record element, you need to enter the following details:
- Label: Enter label.
- API Name: It will automatically populate.
- How Many Records to Create: Here, we will create records from the screen flow, so here, we will select the One option.
- How to Set the Record Fields: Here, we need to map Log a Error object’s fields with the API name with the Flow Execution Error Event. For that, we have to select Use separate resources and literal values.

5. Then, in the Object field, select the Log a Error object.
- Then, we need to set field values for the Log an Error object’s fields. For that, in the Field option, we have to select the object field,
- Then, in the Value option, we have to select Platform Event fields, which are of the Flow Execution Error Event class.

6. After that Save the flow and then click on the Activate button to start the execution of the flow. If we don’t activate flow, then it will not work.

Proof of Concept
7. Now, we will create an account record using the screen flow that we created, which has fields for the account name, email, and ratings.
- Here, I will intentionally leave the account name field blank to check what error will occur, fill out the other fields, and click on the Next button.

8. Here, we have an error, but from here, we cannot identify the cause of the error, so it will be difficult to debug the error.
To view the error, navigate to the Log a Error object tab.

9. Here, you can see the record has been created with the fields that we created in Log a Error object and mapped with the Flow Execution Error Event attributes.
In this object, we can see the Error Name and Description on the Detail Page.
- Log an Error Name: This field stores the name of the flow from which this error occurred.
- Description: The description field we have mapped with the ErrorMassage attribute. This field displays a detailed description of the error that is easy to understand and helpful for debugging.

This is how we can create a platform event triggered flow in Salesforce.
Conclusion
I hope you now have an idea of how to create a platform event-triggered flow in Salesforce. In this topic, we have seen what a platform event is and what a platform event-triggered flow is.
Additionally, we have seen how to create a platform event-triggered flow in Salesforce with real-time scenarios and explanations.
You may like to read:
- Create Scheduled-Trigger Flow in Salesforce
- Create Auto-Launched Flow In Salesforce
- How to Create Multiple Records Using Salesforce Flows
- How to Update Contact Owners with Salesforce Flow
- How to Create an Event with Flow in Salesforce
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.