How to Create an Event with Flow in Salesforce [2 Ways]

While working with Salesforce CRM, I was assigned the task of creating a follow-up event for the Opportunity and Campaign records. Instead of creating the events manually, I decided to automate the task creation using the Salesforce flow.

The two approaches I followed to create events using flows are as follows.

  • Create Events through actions in Salesforce flows
  • Create Events through the Create Record element in Salesforce flows

If you are new to flow, I recommend checking a tutorial on ‘how to create a screen flow in Salesforce.’

Create Events through actions in Salesforce flows

In this example, let’s consider a scenario in which a new opportunity account is created, and an event is assigned to the opportunity’s related Account owner. We will achieve this using a Record-triggered flow, and in that flow, we will add an Action element to create an event for the account owner related to the opportunity record.

To create events through the Action element in Salesforce flows, follow the below steps.

1. Navigate to Salesforce’s setup page, search, and select Flows under Process Automation.

2. In the Flows setup, click on New Flow.

3. Select the option Start from Scratch and click Next. In the next window, select the option Record-Triggered Flow and click on the Create button.

Create event with record triggered flow

4. According to the scenario, select the Object as Opportunity, then in the Configure trigger, select A record is created.

In this example, setting entry conditions for the record to trigger is optional. I have set a condition that the trigger will run when the Lead Source of the Opportunity records the Web.

Create an Event in Salesforce using Flow

5. Create a variable resource for the Start and End fields of the Event. Click on the New Resource button and configure the resource as follows.

  • Select the Resource Type as a Variable.
  • Enter the API Name as datetime.
  • Select the Data Type as date/time, enter the default value, and click Done.
Resource to create Event with flow in Salesforce

6. Add an Action element to the flow, and select the option Event in the Category.

Create Event with Action element in Salesforce

7. Enter the Label and API name for the Event action, then enter the below fields.

  • In the field Assigned ID, select Triggering Opportunity > Account ID > Owner ID.
  • In the fields End Date Time and Start Date Time, select the date/time resource we created.
Create Event for a record using flow in Salesforce

8. In the field Related Record ID, select Triggering Opportunity > Account ID. After this, enter the Subject of the event.

Use Salesforce trigger flow to create an event

9. Save the flow by entering the Label and Flow API label, then click Save.

10. To activate the flow, click on the Activate button.

Salesforce flow Action element to create an event

The flow is created and activated. After this, we will test the flow.

Test the flow

According to the applied conditions in the flow, create a New Opportunity record.

Auto create an event in Salesforce using flows

After creating the Opportunity record, navigate to the Opportunity Account. In the Activity section, you will see the event assigned to the account’s owner.

Use Salesforce Flow to Create Events

This way, we can create an event through Action in Salesforce flows by following the above steps.

Create Events through the Create Record element in Salesforce flows

In this example, we will create a Record-trigged flow that will create an Event for the Campaign record when the Campaign Type field is selected as Webinar for the new record or updated for the existing one.

In this example, we will create a record trigger flow using a Create Record element to create an event for the campaign object.

Follow the below steps to create Events through the Create Record element in Salesforce flows.

1. In the flow setup, select the option Record-triggered flow and click Create.

2. In the trigger flow conditions, select the object as Campaign according to the scenario. In the Configure trigger, select When a record is created or updated. You can also set the entry conditions to filter records.

Create an Event for campaign using flow in Salesforce

3. Add a get record element to the flow, enter the Label, and select the object Campaign.

In the Conditions requirements, I have added a filter to sort Campaigns with type as Webinar.

Create an Event from Create record element in Salesforce flow

4. We need to create a New resource for the Start and End time for the event object. Configure the new resource in the following way.

  • Select the Resource Type as a Variable.
  • Enter the API Name as datetime.
  • Select the Data Type as date/time, enter the default value, and click Done.

5. Add a Create record element and enter the Label. After this, select the Set record Values as Manually and Object as Event.

How to create event with flow in Salesforce

6. In the section Set Field Values for the Event in the Create record element, map the Fields with the following Values.

Field Value
OwnerIdCampaign From Get_Campaigns > Owner ID
StartDate Timecustom Date/time resource
EndDate Timecustom Date/time resource
WhatId ( related to)Campaigns from Get_campaigns > Campaign ID
SubjectEnter the subject of Event
Create an Event from Salesforce trigger flow

7. Save the record-trigger flow.

Create Event for Campaign with Salesforce flow

8. Activate the flow from the Activate button in the flow builder.

How to create event with trigger flow in Salesforce

Now, we have created and Activated the flow. In the next steps, we will test the flow.

Test the flow

According to the criteria applied in the trigger conditions, I will update the Campaign Type to Webinar.

As we update the Campaign Type to webinar, the event will be created for the updated campaign.

Auto create an event in Salesforce using trigger flows

To view the created Event, click on the Activity tab.

Salesforce event created with record triggered flow

This way, we can create an event using the Creating Record element in the Salesforce Flow.

Conclusion

In Salesforce, automating the process of record creation using Salesforce flows helps streamline data management in the org by saving time from manual record creation.

In the above examples, we discussed the two possible ways to create an Event in Salesforce using the Salesforce record-triggered flow, where we created events for the Account and the Campaign records.

By following the above steps, you might have understood the process of creating Events using the Create record element and Action element in Salesforce flows.

If you want to create the events using the Apex triggers, you can go to the trailhead tutorial Adding Event through Apex trigger.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.