Skip to main content

#Record-Triggered13 debatiendo

#Salesforce #Record-Triggered

  

How would you design a Record-Triggered Flow that automatically updates related records when an Account's Industry changes, while preventing recursion and unnecessary updates?

2 respuestas
  1. 17 oct, 17:31

    Hi @Rakesh Goud You can use an After-Save Record-Triggered Flow to automatically update related records when an Account's Industry changes.

    Steps:

    1. Go to Setup → Flows → New Flow → Record-Triggered Flow.
    2. Select Account as the object.
    3. Trigger the Flow when a record is updated.
    4. Select After Save because we need to update related records.
    5. Add a Decision element to check whether the Industry has changed.
    6. Use Update Records to update the related records, such as Contacts, based on the Account Id.
    7. Save, debug, and activate the Flow.

    How to prevent recursion and unnecessary updates:

    • Use ISCHANGED(Industry) to run the Flow only when Industry changes.
    • Set the entry criteria to run only when the record meets the required conditions.
    • Update only related records that actually need changes.
    • Avoid updating the same Account again unless required.
    • Check whether any other Flows or Apex Triggers could update the Account again.
    • Use one Update Records element for matching records instead of updating records individually in a loop.

    Real-Time Example:

    If an Account's Industry changes from Banking to Healthcare, the Flow can automatically update a custom Industry field on all related Contacts.

    Useful Salesforce Documentation:

    My suggestion: Use an After-Save Flow with change detection and filtered updates. This helps avoid unnecessary execution and reduces the risk of recursion.

    Hope this helps!

0/9000

#Salesforce #Record-Triggered How would you design a Record-Triggered Flow to automatically update a record, send an email notification, and create a follow-up task when an Opportunity reaches the Closed Won stage?

1 respuesta
  1. 17 oct, 07:08

    Hi @SAITEJA B Good question! Record-Triggered Flows are a great way to automate business processes in Salesforce without writing Apex code.

    1. Recommended Flow Design

    Scenario: When an Opportunity moves to Closed Won, update the record, send an email, and create a follow-up Task.

    1. Create Flow: Setup → Flows → New Flow → Record-Triggered Flow.
    2. Select Object: Opportunity.
    3. Entry Condition: Stage = Closed Won.
    4. Trigger: When a record is created or updated.
    5. Run Condition: Only when the record meets the entry conditions for the first time.
    6. Update Record: Update required Opportunity fields.
    7. Send Email: Use the Send Email action to notify the Opportunity Owner.
    8. Create Task: Create a follow-up Task assigned to the Opportunity Owner.

    2. Important Best Practices

    • Use an After-Save Flow for creating Tasks and sending emails.
    • Use a Before-Save Flow when only updating fields on the triggering record.
    • Avoid unnecessary Get Records and Update Records inside loops.
    • Prevent repeated execution using entry conditions.
    • Add fault paths and test using Flow Debugger.

    3. Official Salesforce Resources

    Build this automation in a Developer Org and test what happens when an Opportunity changes from Negotiation to Closed Won.

    Key Point:

    Use Record-Triggered Flows for business automation without Apex, but always focus on performance, error handling, and avoiding duplicate actions. 

     

    Hope this helps! Venkat Yadav | SFDCINDIA

0/9000

#Salesforce #Record-Triggered #Flows What real-world business scenarios should a Salesforce learner implement using Record-Triggered Flows, Screen Flows, Scheduled-Triggered Flows, and Scheduled Paths to understand automation, avoid recursion, and handle errors effectively?

2 respuestas
  1. 17 oct, 04:28

    Hi @Sai Kumar Good question! The best way to learn Salesforce Flows is to practice real-world business scenarios.

    1. Practical Flow Scenarios

    1. Record-Triggered Flow: Create a follow-up Task when an Opportunity is Closed Won.
    2. Screen Flow: Build a customer registration or case creation form.
    3. Scheduled-Triggered Flow: Check overdue Cases daily and notify owners.
    4. Scheduled Paths: Send a reminder 3 days after a Lead is created.
    5. Fault Paths: Handle Flow errors and log failure details.

    2. Important Best Practices

    • Use entry conditions to avoid unnecessary execution.
    • Use before-save Flows for updating fields on the triggering record.
    • Avoid unnecessary Get Records and Update Records inside loops.
    • Prevent recursion by checking field changes.
    • Test using Flow Debugger and different scenarios.

    3. Official Salesforce Resources

    Build one complete Lead Management project using different Flow types and error handling.

    Key Point:

    Don't just learn how to create Flows. Understand when to use each Flow type and how to troubleshoot issues. 

     

    Hope this helps! Venkat Yadav | SFDCINDIA

0/9000

#Trailhead #Record-Triggered

 

In a real-time business scenario, how would you decide between Before-Save and After-Save Record-Triggered Flows based on performance and related-record updates?

2 respuestas
  1. 14 oct, 13:59

    Hi @Vinjamuri Teja The choice between Before-Save and After-Save Flow depends on the business requirement.

    1. Before-Save Flow

    • Use it to update fields on the same record.
    • Runs before the record is saved.
    • Faster and better for performance.
    • Example: Automatically set Opportunity Priority based on Amount.

    2. After-Save Flow

    • Use it to create or update related records.
    • Runs after the record is saved.
    • Supports actions like sending emails and creating Tasks.
    • Example: When an Opportunity becomes Closed Won, automatically create a follow-up Task.

    Best Practice: Always prefer Before-Save Flow for same-record field updates and After-Save Flow for related-record updates or additional actions.

    Hope this helps!

0/9000

#Trailhead Challenges #Apex #Record-Triggered When should we use Apex Triggers instead of Record-Triggered Flows? Could you share a real-time business scenario where Apex is the better choice?

1 respuesta
  1. 12 oct, 10:44

    Hi @Abhiram Sailada Both Apex Triggers and Record-Triggered Flows are used for automation in Salesforce, but choosing the right one depends on the business requirement.

    When I prefer Record-Triggered Flow:

    • Simple to medium-complexity automation.
    • Field updates, validations, notifications, and related record creation.
    • Easy maintenance without writing code.

    When I prefer Apex Trigger:

    • Complex business logic and calculations.
    • Advanced processing across multiple objects.
    • Better control over bulk processing, performance, and error handling.

    Real-time example:

    Imagine an e-commerce company processing thousands of orders. For each order, we need to check inventory, calculate discounts, update stock, and prevent overselling.

    In this scenario, I would prefer an Apex Trigger with a handler class

    because we need more control over complex logic, bulk operations, and record locking. 

     

    My suggestion: Always consider Flow first. If the requirement becomes too complex or needs more technical control, go with Apex.

    One important point: Flow also supports bulk processing, so don't choose Apex just because the data volume is high.

0/9000

Good afternoon, 

 

The hands-on challenge is not done yet because it says "

In the 'Review Opportunity with Account Owner' flow, we can’t find a Path with the API name 'X3_Days_After_Last_Modified_Date'. Make sure you saved the changes in your flow.

" 

 

I´ve done it again three times already and is still incorrect. Can I have your help? Thanks! 

 

#Trailhead Challenges  #Record-Triggered  #Flow

8 respuestas
0/9000
4 respuestas
  1. 25 feb 2024, 09:10

    @venkateswarlu Allipudi

    Check the below trigger :

    trigger PreventCaseDeletion on Case (before delete) {

    // Set to store IDs of Cases being deleted to minimize the query scope

    Set<Id> caseIdsBeingDeleted = Trigger.oldMap.keySet();

    // Query to find Cases that are being deleted and are related to both an Account and a Contact

    List<Case> casesWithAccountAndContact = [

    SELECT Id

    FROM Case

    WHERE Id IN :caseIdsBeingDeleted

    AND AccountId != null

    AND ContactId != null

    ];

    // Set to store the IDs of Cases that meet the criteria for prevention

    Set<Id> preventDeletionCaseIds = new Set<Id>();

    for (Case c : casesWithAccountAndContact) {

    preventDeletionCaseIds.add(c.Id);

    }

    // Loop through the Cases in Trigger.old to find matches and prevent deletion

    for (Case c : Trigger.old) {

    if (preventDeletionCaseIds.contains(c.Id)) {

    // Prevent deletion by adding an error to the Case record

    c.addError('Cannot be deleted because it is related to both an Account and a Contact.');

    }

    }

    }

0/9000

Did you know you can apply Validation Rules in a Approval Process using a Custom Error Message in Flow?

 

This can prevent a invalid record from being submitted for Approval and instruct the users how to remedy the problem.

 

Find out more in this how-to video; https://youtu.be/XhAO2emDOdA?si=HQOKzbC0g3a_lF2-

 

#Flow #ApprovalProcess #Record-Triggered #Salesforce #Salesforce Developer #Salesforce Admin #TrailblazerCommunity #CRM Configuration 

0/9000

Hello Community! Im stuck and need your help!

 

I have a custom object (+tab) that allows users to create records

On this object there is a lookup field (for Site Name) to the Site Object

 

I want to prevent users from being able to create multiple records with the same Site Name

 

Ive created a Checkbox on my object

Ive created a Validation Rule pointing to the checkbox

Ive created a Record Triggered Flow that contains

 - Get Records

 - Decision

- and Assignment elements

 

I am not even able to create a single record without my error message popping up, as I believe its treating my Site Name lookup value as "already exists" (which it does it its own object) but NOT in my custom object.    

 

Anyone know how to make my flow / rules look for duplicate records ONLY on my custom object?

 

Hope this makes sense.

Thanks,

Nick

 

 

#Record-Triggered #Flows #Validation Rules

2 respuestas
  1. 29 feb 2024, 21:07

    @Priyanshu Gupta thanks for the help!  Ive tried many variations of this kind of validation rule ALL with syntax errors.  Im starting to think that my Site Name look up fields and Site Name formula fields are causing the issue.  Im trying to look at the formula field of current records to see if there are existing values.

     

    Here are some example value names to help with another try!  

     

    object name =  site support details

    lookup field = Site Name

    formula filed = SSD Site (this field populates what the user selects from the site name look up field)

0/9000

For context of myself: I have never built a flow before (besides following tutorials). I feel like I have a general idea but am also all over the place with my thoughts on how to build this flow. I am looking for advice/ guidance on whether this flow is possible, if there is a way to simplify the flow, if I am missing resources/elements or if there are other simpler solutions I am overlooking.

 

The flow itself will be gathering records related to a contact's account's assigned user(s) and contact's account's assigned territory/territories then updating the record of the contact that triggered the flow. I plan to use this information to set criteria for sending email alerts or setting an approval process for contacts moved based on the territory of the account the contact was in and to the assigned users of the territory of the account the contact was in. I am attaching a PDF file that I have been using to brainstorm how I will create this flow and gives more context to why I am creating the flow and what issue I am trying to solve. Any guidance is greatly appreciated! Thank you!

 

#Flows  #Salesforce  #Automation  #Flow  #Record-Triggered

1 respuesta
  1. 29 feb 2024, 16:33

    Another thought I had is using a screenflow to gather information rather than creating a flow to populate a field then using a decision element to create different pathways based on the information gathered from the rep. Such as if I could get the rep to select from a picklist the assigned user/assigned users in the territory of the account they are moving contact from to send email to the users selected. Also do not know if this is possible but think it could simplify the flow if so. 

0/9000