Add Automation to Your App
Automate Dreamfest Record Creation
Now that the registration process is in place, you can go even further! Every time an attendee registers for Dreamforce, they should also be registered automatically for the Dreamfest session. To automate this, you use a tool called Flow Builder.
Flow This Way
Let’s use Flow Builder to create an automation that adds the Dreamfest session for every attendee for the Dreamforce event.
- Click and select Setup.
- enter
Flows
in the Quick Find box and select Flows.
- Click New Flow.
- Select Record-Triggered Flow and click Create.
- For Object, enter
Event Registration
and select Event Registration.
- Select A record is created or updated.
- Ensure None is selected for the Condition Requirements.
- Ensure Actions and Related Records is selected.
Add a New Resource
Create a resource, in this case a formula, that you will reference later in this unit.
- Click to open the Flow Builder Toolbox.
- Click New Resource.
- For Resource Type, select Formula.
- Enter
sessionRegistrationName
for the API Name.
- For Data Type, select Text.
- Add
{!$Record.Attendee__r.FirstName} & " " & {!$Record.Attendee__r.LastName} & " - Dreamforce 2023"
to the Formula text box.
- Click Check Syntax.
- Click Done.
Add a Decision Element
Now add the action you want to happen when your conditions are met. In this case, you want to add a decision element.
- On the path after the Start element, hover over and click .
- Search and select Decision.
- Enter the following details:
- Label:
Is the Event DF23?
- Ensure API Name is Is_the_Event_DF23
Two paths will be created from this decision element. The yes outcome and the no outcome. First, create the yes parameters.
- With the New Outcome option selected in the Outcome Order, enter the following information:
- Label:
Yes
- Outcome API Name:
Yes
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- For Resource, select $Record > Event_Name__r > Name
- Operator: Equals
- Value:
Dreamforce 2023
- When to Execute Outcome: Only if the record that triggered the flow to run is updated to meet the condition requirements
- Click Default Outcome in the Outcome Order.
- Remove the current label text and enter
No
for the Label.
- Click Done.
Create Elements for the Yes Outcome
- Under the Yes element, hover over and click .
- Search and select Get Records.
- Enter
Get Dreamfest Session
as the Label.
- Ensure the API Name is
Get_Dreamfest_Session
.
- In the Get Records of This Object section, select session for Object.
- For Condition Requirements, select All Conditions Are Met (AND) and enter the following information:
Field |
Name |
---|---|
Operator |
Equals |
Value |
Dreamfest 2023
|
- Select Not Sorted for Sort Order.
- Select Only the first record for How Many Records to Store.
- Select Automatically store all fields for How to Store Record Data.
Now that the records have been pulled, time to do something with this information by creating a new record for session registration.
- Under the Get Dreamfest Session element, hover over and click .
- Search and select Create Records.
- Enter the following details:
- Label:
Create Session Registration
- API Name:
Create_Session_Registration
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- For object, select Session Registration
- In the Set Field Values for the Session Registration section, click +Add Field three times.
- Enter the following details:
- Field 1: select Attendee__c a
- Value 1: select $Record > Attendee__r > Id
- Field 2: select Name
- Value 2: select sessionRegistrationName
- Field 3: select Public_Events__c
- Value 3: select $Record > Event_Name__c
- Field 4: select Session_Name__c
- Value 4: select Session from Get_Dreamfest_Session > Id
Save and Activate the Flow
- Click Save in the upper right.
- Label your new Flow as
Dreamforce Event Registration
.
- Ensure the Flow API Name is Dreamforce_Event_Registration.
- Click Save.
- Click Activate.
- Click in the upper left.
Try It Out
Next, create a sample record and see how it all works together.
- Click to open App Launcher.
- Under All Items, select Event Registrations.
- Click New.
- Give the registration any name.
- For Attendee, create a new contact with your name and click Save.
- For Event Name, select Dreamforce 2023.
- Click Save.
Now click the Session Registrations tab, and see the record that was automatically created for Dreamfest 2023.
You Did It!
Congratulations! You installed a managed package, and then you extended that package by adding a custom object, custom fields, and automation, and you added sample data along the way. Well done!
Resources