Skip to main content

Flow Example: Customer Onboarding

This complete example demonstrates how different flow steps work together in a real-world scenario.

Scenario​

When a new customer is created, we need to:

  1. Retrieve the customer details
  2. Set up their account based on their tier (Premium vs Standard)
  3. Calculate contract dates
  4. Create a contract record
  5. Send welcome emails to all contacts
  6. Publish an event for other systems

Flow Definition​

Flow Name: OnboardNewCustomer

Description: When a new customer is created, set up their account with default settings, create related records, and send a welcome email.

Inputs:

NameTypeRequiredDescription
CustomerIdEntity Reference (Account)YesThe new customer record

Outputs:

NameTypeDescription
SuccessBooleanWhether onboarding completed successfully
ContractIdEntity ReferenceThe created contract record
ContactsNotifiedIntegerNumber of contacts who received welcome emails

Flow Steps​

┌─────────────────────────────────────────────────────────────────┐
│ STEP 1: GET ENTITY BY ID │
│ ─────────────────────────────────────────────────────────────── │
│ Entity: Account │
│ Entity ID: CustomerId │
│ → Store in variable: Customer │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 2: CONDITION - Is Premium Customer? │
│ ─────────────────────────────────────────────────────────────── │
│ Condition: Customer.CustomerTier == "Premium" │
└─────────────────────────────────────────────────────────────────┘
│ │
┌─────────────────────────────────────────────────────────────────┐
│ TRUE │ FALS │
▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ STEP 3a: NEW VARIABLE │ │ STEP 3b: NEW VARIABLE │
│ ───────────────────────── │ │ ───────────────────────── │
│ Name: WelcomeTemplate │ │ Name: WelcomeTemplate │
│ Value: "premium-welcome" │ │ Value: "standard-welcome" │
└─────────────────────────────────────────────────────────────┘
│ │
▼ │
┌───────────────────────────────────────────────┐
│ STEP 4a: SAVE ENTITY │ │
│ ───────────────────────── │ │
│ Entity: Task │ │
│ Data: { │ │
│ Subject: "Schedule │ │
│ onboarding call", │ │
│ Regarding: Customer, │ │
│ Owner: Customer. │ │
│ AccountManager │ │
│ } │ │
└───────────────────────────────────────────────┘
│ │
└───────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 5: RUN LOGIC BLOCK │
│ ─────────────────────────────────────────────────────────────── │
│ Block: CalculateContractDates │
│ Inputs: { │
│ StartDate: TODAY(), │
│ Tier: Customer.CustomerTier │
│ } │
│ → Store outputs in: ContractDates │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 6: SAVE ENTITY │
│ ─────────────────────────────────────────────────────────────── │
│ Entity: Contract │
│ Data: { │
│ Customer: Customer, │
│ StartDate: ContractDates.StartDate, │
│ EndDate: ContractDates.EndDate, │
│ Status: "Active" │
│ } │
│ → Store in variable: NewContract │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 7: EXECUTE QUERY │
│ ─────────────────────────────────────────────────────────────── │
│ Entity: Contact │
│ Multiplicity: Multiple │
│ Filter: ParentCustomerId == Customer.Id │
│ → Store in variable: CustomerContacts │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 8: NEW VARIABLE │
│ ─────────────────────────────────────────────────────────────── │
│ Name: EmailsSent │
│ Type: Integer │
│ Initial Value: 0 │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 9: ITERATOR - For each Contact │
│ ─────────────────────────────────────────────────────────────── │
│ Collection: CustomerContacts │
│ Item Variable: Contact │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ STEP 9a: SAVE ENTITY │ │
│ │ ─────────────────────────────────────────────────────── │ │
│ │ Entity: Email │ │
│ │ Data: { │ │
│ │ To: Contact, │ │
│ │ Subject: "Welcome to Our Service", │ │
│ │ Body: GetEmailTemplate(WelcomeTemplate), │ │
│ │ Regarding: Customer │ │
│ │ } │ │
│ │ → Store in: WelcomeEmail │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ STEP 9b: SEND EMAIL │ │
│ │ ─────────────────────────────────────────────────────── │ │
│ │ Email ID: WelcomeEmail.Id │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ STEP 9c: UPDATE VARIABLE │ │
│ │ ─────────────────────────────────────────────────────── │ │
│ │ Variable: EmailsSent │ │
│ │ Set Variable: EmailsSent + 1 │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 10: PUBLISH EVENT │
│ ─────────────────────────────────────────────────────────────── │
│ Event: CustomerOnboarded │
│ Payload: { │
│ CustomerId: Customer.Id, │
│ ContractId: NewContract.Id, │
│ Tier: Customer.CustomerTier, │
│ ContactsNotified: EmailsSent │
│ } │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STEP 11: SET OUTPUT │
│ ─────────────────────────────────────────────────────────────── │
│ Output Bindings: │
│ Success: true │
│ ContractId: NewContract.Id │
│ ContactsNotified: EmailsSent │
└─────────────────────────────────────────────────────────────────┘

Step Categories Used​

This flow demonstrates all major step categories:

CategorySteps Used
Data OperationsGet Entity by ID (Step 1), Save Entity (Steps 4a, 6, 9a), Execute Query (Step 7)
Flow ControlCondition (Step 2), Iterator (Step 9)
VariablesNew Variable (Steps 3a/3b, 8), Update Variable (Step 9c)
IntegrationSend Email (Step 9b)
InvocationRun Logic Block (Step 5)
EventsPublish Event (Step 10)
OutputSet Output (Step 11)

Key Design Patterns​

Conditional Setup​

Steps 2-4 show how to handle different paths based on customer tier. Premium customers get a scheduled onboarding call; standard customers proceed directly.

Reusable Logic​

Step 5 calls a Logic Block to calculate contract dates. This keeps date calculation logic separate and reusable.

Steps 7-9 retrieve all contacts and send each one a personalized email. The iterator handles any number of contacts.

Event Publishing​

Step 10 publishes an event so other systems can react to the onboarding completion without being directly coupled to this flow.

Clean Output​

Step 11 sets clear outputs so callers know exactly what happened: success status, the contract created, and how many contacts were notified.