Use Cases
  • 03 May 2023
  • 3 Minutes to read
  • Dark
    Light

Use Cases

  • Dark
    Light

Article Summary

Auto-register your Attendees to mandatory Sessions of the Event using a visual flow and process builder.

Introduction

You can now automatically have Session Attendees created in Salesforce for all your Attendees who have registered for the Event with only clicks no code.

Setup Steps

Flow Diagram

A. Create a Flow

Navigate to Setup > Flows > New Flow > Select "Autolaunched Flow (No Trigger)" > Create.

Flow Elements

1. Get Attendee: This element will pass the Attendee record ID via process builder into the flow.

Object > Attendee
Condition Requirements
ID = AttendeeID (Text Variable)
How Many Records to Store: Only the first record
How to Store Record Data: Automatically store all fields

2. Get Sessions: Get the Session records where Mandatory = "True" AND the Session record Event ID = Attendee record Event ID.

Object >Session
Condition Requirements - Conditions are Met
Mandatory = True (Custom checkbox on session)
Event = Attendee.Event.id (Getting the related Attendee's Event ID)
How Many Records to Store: All records
Select Variable to Store Session Records > Mandatory Sessions (New Record Collection Variable)
Select Session Fields to Store in Variable > ID

3. Get Session Attendee Records: Get all existing Session Attendee records to find one already exists for our Attendee.

Object >Session Attendee
Condition Requirements - Conditions are Met
Attendee = AttendeeID (Variable)
How Many Records to Store: All records
How to Store Record Data: Automatically store all fields

4. Decision to check if mandatory Session exists: Here we check to see if the Session collection variable from Step 2 is empty. This prevents the flow from failing if the particular Event has no Session records marked mandatory or has no Session records at all.

Outcome label - mandatory sessions exist 
When to Execute Outcome: All Conditions Are Met
Mandatory Session (Record collection variable) Is Null False

5. Session Loop: This element takes individual records from our Session collection variable from Step 2 and iterates over them to pull out the individual Session IDs for further processing.

Specify Direction for Iterating Over Collection > First item to last item.

6. Decision to check if there are existing Session Attendee records: here we check to see if any records were returned from our Get Session Attendee Records element from Step 3.

Outcome label - session attendees exist?
When to Execute Outcome: All Conditions Are Met
Get Session Attendee Records (Record collection variable) Is Null False

If the outcome of the Decision from Step 6 is Default Outcome, meaning there are no existing Session Attendee records at the beginning of this Flow interview, the flow will proceed to Steps 7 and 8.

7. Assign Session Attendees: This assignment element takes the Session ID from the loop variable along with the Attendee ID variable and assigns them to the appropriate fields within a record variable called NewSessionAttendee. It also sets Registration Status of the new Session Attendee records to "Registered".

8. Assignment to Record Collection: This assignment element adds the current values of the NewSessionAttendee record variable from Step 5 to a record collection variable called NewSessionAttendeeCollection. We will use this record collection variable in the last element to create all Session Attendee records all at once with a single element.

**Steps 7 and 8 repeats for each record in the collection from Step 2.

Steps 9 and 10 are a nested loop within our primary Loop (Step 5). The purpose of this nested loop is to first check any existing Session Attendee records to ensure we aren't creating any duplicate Session Attendee records in Steps 7 through 9

9 and 10. Existing Session Attendee Loop & Decision: If there are any existing Session Attendees associated with the current Attendee ID and Session ID, this element will handle all records from the Step 3 and no further processing will be required.

11. Create Records: This final step creates the Session Attendee records from the NewSessionAttendeeCollection variable.

B. Activate Flow

C. Create a process builder.

New >Process Name>Create session attendees for mandatory sessions
Process starts when > A record changes
Choose object > Attendee
Define Criteria > Criteria Name > Check Registration status 
Conditions > Attendee = Registered (Status field)
Immediate Action >Flow
Set Flow Variable = AttendeeID = Attendee.Id.

D. Activate Process Builder

E. Test

  1. Navigate to your Event.
  2. Click the Event URL.
  3. Register an Attendee.
  4. Visit the Attendee record in Salesforce and see your registered Session Attendees!

Test