Skip to main content

Record-Triggered Flow

 

Example 1: Record-Triggered Flow

Goal: When an Opportunity is moved to Closed Won, automatically (1) create a follow-up Task for the owner and (2) set the related Account’s Customer Status to Active.

1) Create the flow

  1. Go to Setup → Process Automation → Flows → New Flow.

  2. Choose Record-Triggered FlowCreate.

  3. Object: Opportunity

  4. Trigger: “A record is updated

  5. Entry Conditions:

    • StageName Equals Closed Won

  6. When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements (prevents repeated runs).

  7. Optimize the Flow For: Actions and Related Records (After Save) (needed because we’ll create a Task and update an Account).

Click Done.

2) (Optional) Add a formula resource for due date

  1. In the Manager tab → New Resource.

  2. Resource Type: Formula | Data Type: Date

  3. API Name: FollowUpDueDate

  4. Formula: TODAY() + 3
    Click Done.

3) Create the follow-up Task

  1. Drag Create Records onto the canvas.

  2. Label: Create Follow-Up Task

  3. How Many Records to Create: One

  4. How to Set the Fields: Use separate resources, and literal values

  5. Set fields:

    • Subject: Welcome / Kickoff call

    • Status: Not Started

    • Priority: Normal

    • OwnerId: {!$Record.OwnerId}

    • WhatId: {!$Record.Id} (relates the task to the Opportunity)

    • ActivityDate (Due Date): {!FollowUpDueDate} (or choose a static date offset if you skip the formula)

    • Description: Auto-created when Opportunity moved to Closed Won.

Click Done.

4) Update the related Account

  1. Drag Update Records onto the canvas.

  2. Label: Mark Account as Active

  3. How to Find Records to Update: Specify conditions…

  4. Object: Account

  5. Conditions: Id Equals {!$Record.AccountId}

  6. Set Field Values for the Account:

    • Customer_Status__c = Active (replace with your actual field)

Click Done.

5) Save, debug, and activate

  1. Save the flow. Give it a name like Opp_ClosedWon_AutoTask_And_AccountUpdate.

  2. Click Debug and test with a sample Opportunity (or use Debug on Canvas).

  3. Click Activate.

6) Test it end-to-end

  1. Open an Opportunity, change StageClosed Won and Save.

  2. Verify:

    • A Task exists under Activity with correct owner/due date.

    • The related Account has Customer_Status__c = Active.

Why this design?

  • Using “Only when updated to meet conditions” prevents duplicate tasks.

  • After-save is required for creating related records (Tasks) and updating other objects (Account).

  • Keeping logic in one flow per object/trigger keeps things maintainable.


Example 2: Screen Flow (quick Case creation)

Goal: Let agents create a Contact (if needed) and a related Case from one guided screen.

Steps (high level)

  1. New Flow → Screen Flow → Create.

  2. Screen: Add inputs

    • Text: Full Name, Email: Email, Phone: Phone

    • Text: Subject, Long Text: Description

    • Picklist (Choice): Priority (Low/Medium/High)

  3. Get Records (Contact): Find existing Contact where Email = {!Email} (Get first record).

  4. Decision: Found?

    • Yes → use that Contact.

    • NoCreate Records (Contact) with Name/Email/Phone.

  5. Create Records (Case):

    • ContactId = Contact from step 3/4

    • Subject, Description, Priority from the screen inputs.

  6. Screen (Confirmation): Show the Case Number.

  7. Save and Activate.

  8. (Optional) Add the flow to an app page: Setup → Lightning App Builder → open page → add Flow component → select your flow → Save and Activate.


Tips & gotchas

  • Naming: Prefix flows (e.g., RTF_Opportunity_ClosedWon_FollowUp).

  • Before-save vs After-save: Use before-save only for fast field updates on the same record; after-save for creating/updating other records.

  • Order of execution: Flows run with other automations—avoid duplicating logic you still have in Workflow Rules/Process Builder.

  • Fault paths: For Create/Update elements, add a Fault connector to a Send Email or Create Log action to capture failures.

  • Deploy safely: Build and test in a sandbox, then deploy via Change Set/DevOps.

  • Access: Ensure users have permission to run the flow or that it runs in System Context when appropriate.

If you want, tell me your object/field names and the exact business rule you need—I’ll tailor the flow steps (including formulas and decisions) precisely to your org.

Comments

Popular posts from this blog

DSA in C# | Data Structure and Algorithm using C#

  DSA in C# |  Data Structure and Algorithm using C#: Lecture 1: Introduction to Data Structures and Algorithms (1 Hour) 1.1 What are Data Structures? Data Structures are ways to store and organize data so it can be used efficiently. Think of data structures as containers that hold data in a specific format. Types of Data Structures: Primitive Data Structures : These are basic structures built into the language. Example: int , float , char , bool in C#. Example : csharp int age = 25;  // 'age' stores an integer value. bool isStudent = true;  // 'isStudent' stores a boolean value. Non-Primitive Data Structures : These are more complex and are built using primitive types. They are divided into: Linear : Arrays, Lists, Queues, Stacks (data is arranged in a sequence). Non-Linear : Trees, Graphs (data is connected in more complex ways). Example : // Array is a simple linear data structure int[] number...

JSP Page design using Internal CSS

  JSP is used to design the user interface of an application, CSS is used to provide set of properties. Jsp provide proper page template to create user interface of dynamic web application. We can write CSS using three different ways 1)  inline CSS:-   we will write CSS tag under HTML elements <div style="width:200px; height:100px; background-color:green;"></div> 2)  Internal CSS:-  we will write CSS under <style> block. <style type="text/css"> #abc { width:200px;  height:100px;  background-color:green; } </style> <div id="abc"></div> 3) External CSS:-  we will write CSS to create a separate file and link it into HTML Web pages. create a separate file and named it style.css #abc { width:200px;  height:100px;  background-color:green; } go into Jsp page and link style.css <link href="style.css"  type="text/css" rel="stylesheet"   /> <div id="abc"> </div> Exam...

Uncontrolled form input in React-JS

  Uncontrolled form input in React-JS? If we want to take input from users without any separate event handling then we can uncontrolled the data binding technique. The uncontrolled input is similar to the traditional HTML form inputs. The DOM itself handles the form data. Here, the HTML elements maintain their own state that will be updated when the input value changes. To write an uncontrolled component, you need to use a ref to get form values from the DOM. In other words, there is no need to write an event handler for every state update. You can use a ref to access the input field value of the form from the DOM. Example of Uncontrolled Form Input:- import React from "react" ; export class Info extends React . Component {     constructor ( props )     {         super ( props );         this . fun = this . fun . bind ( this ); //event method binding         this . input = React . createRef ();...