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.
- Make sure Start from Scratch is selected, and click Next.
- 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.
- For API Name, enter
sessionRegistrationName
.
- For Data Type, select Text.
- In the Formula text box, enter:
{!$Record.Attendee__r.FirstName} & " " & {!$Record.Attendee__r.LastName} & " - Dreamforce 2023"
- Click Check Syntax.
- Click Done.
- Click to close the Flow Builder Toolbox.
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, 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)
- Resource: Triggering Event_Registration__c > Event Name > Public Event 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 to close the Decision element panel.
Create Elements for the Yes Outcome
- Under the Yes element, click .
- Search and select Get Records.
- For the Label, enter
Get Dreamfest Session
.
- Ensure the API Name is
Get_Dreamfest_Session
.
- In the Get Records of This Object section, for Object, select Session.
- For Condition Requirements, select All Conditions Are Met (AND) and enter the following information:
- Field: Name
- Operator: Equals
- Value:
Dreamfest 2023
- Field: Name
- For Sort Order, select Not Sorted.
- For How Many Records to Store, select Only the first record.
- For How to Store Record Data, select Automatically store all fields.
Now that the records have been pulled, time to do something with this information by creating a new record for session registration.
- On the Yes path after the Get Dreamfest Session element, click .
- Search and select Create Records.
- Enter the following details:
- Label:
Create Session Registration
- API Name:
Create_Session_Registration
- How to Set the Record Fields: Manually
- Object: Session Registration
- In the Set Field Values for the Session Registration section, click +Add Field three times.
- Enter the following details:
- Field 1: Attendee
- Value 1: Triggering Event_Registration__c > Attendee (the one with a > at the end of the line) > Contact ID
- Field 2: Session Registration Name
- Value 2: sessionRegistrationName
- Field 3: Public Event Name
- Value 3: Triggering Event_Registration__c > Event Name (the one without a > at the end of the line)
- Field 4: Session Name
- Value 4: Session from Get Dreamfest Session > Record 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