Flow Automation: Boarding Pass Generation in Salesforce
Flow Name:
GenerateBoardingPass
Purpose:
To automatically generate a Boarding Pass record when a Ticket is marked as Paid and Confirmed, pulling all required data from related Flight and Passenger records.
Flow Type:
Record-Triggered Flow
Step-by-Step Configuration
Step 1: Flow Trigger Setup
- Object: Ticket__c
- Trigger Type: A record is Updated
- Entry Conditions:
- Payment_Status__c Equals Paid
- Ticket_Status__c Equals Confirmed
- When to Run the Flow:
- Only when a record is updated to meet the condition requirements
- Optimize Flow For: Actions and Related Records (After-Save Flow)
- Object: RoomTrigger the Flow When: A record is created or updated
- Set Entry Conditions: (optional but recommended for performance)
- Example: Only trigger if Status = Booked or Occupied
- When to Run the Flow for Updated Records:
- Only when a record is updated to meet the condition requirements
- Optimize the Flow For:
- Fast Field Updates (Not suitable since we need custom logic)
- Actions and Related Records (Required for custom error handling)
Step 2: Formula Resource
- Resource Type: Formula
- API Name: DeparTIme
- Data Type: Date/Time
- Formula:
plaintext
CopyEdit
$Record.Flight__r.Departure_Time__c – (30 / 1440)
- Purpose: To calculate boarding time 30 minutes before the flight’s departure.
Step 3: Get Passenger Record
- Element: Get Records
- Label: Get Passenger
- Object: Passenger__c
- Filter Condition:
- Full_Name__c Equals $Record.Passenger__r.Full_Name__c
- How Many Records: Only the first record
- Store Fields: Automatically store all fields
Step 4: (Optional) Get Ticket Record
- Element: Get Records
- Label: Get Ticket
- Object: Ticket__c
- Filter Condition:
- Ticket_Number__c Equals $Record.Id
- How Many Records: Only the first record
- Store Fields: Automatically store all fields
Step 5: Decision Element
- Label: Check Details
- Outcome: Boarding Status Check
- Condition Requirements:
- $Record.Payment_Status__c Equals Paid
- $Record.Ticket_Status__c Equals Confirmed
- Outcome Type: If condition requirements are met
Step 6: Create Boarding Pass Record
- Element: Create Records
- Label: Get Boarding Pass
- Object: Boarding_Pass__c
- How to Set Values: Manually assign field values
Field Mappings:
Boarding Pass Field | Value from Triggered or Related Record |
---|---|
Boarding_Time__c | DeparTIme (Formula Resource) |
Departure_Gate__c | $Record.Flight__r.Departure_Gate__c |
Flight__c | $Record.Flight__c |
Passenger__c | $Record.Passenger__c |
Seat_Number__c | $Record.Select_Seats__c |
Terminal__c | $Record.Flight__r.Departure_Terminal__c |
Ticket__c | $Record.Id |
Step 7: Save and Activate Flow
- Flow Name: GenerateBoardingPass
- Status: Active