Salesforce Flow Loops Explained | Use to Create Multiple Records

Поділитися
Вставка
  • Опубліковано 14 лип 2024
  • If you're completely new to Flow Loops and/or a visual learner, this video is for you! Made with beginners in mind, we cover what a Loop is, how it works, and how you might use one to create multiple records in Salesforce. For this example, we're creating Task records for Opportunities.
    00:00 Intro
    00:08 About Loops
    01:12 How Loops Work (Visual Aid)
    02:03 The Business Requirement (example)
    03:43 1 - Create the Loop in Flow
    04:04 2 - 'For Each' Path - Assign Task Record Values
    06:23 3 - 'For Each' Path - Assign Task Record to Collection
    08:04 - Quick Loop Recap
    08:31 4 - 'After Last' Path - Create Records
    08:53 - Testing/Debugging
    HELPFUL LINKS 👏:
    Loop Element Documentation from Salesforce - help.salesforce.com/s/article...

КОМЕНТАРІ • 31

  • @frankcosette3046
    @frankcosette3046 Місяць тому +1

    Really good quality delivery on your part. Many should learn from you on how to teach. I can only assume there is a team behind you.

  • @formerbabyfutureghost
    @formerbabyfutureghost 3 місяці тому

    This is the video that finally got single record variables and record collections for loops to sink into my brain. THANK YOU!!!

    • @employedforgood
      @employedforgood  3 місяці тому +1

      That is so awesome once it finally happens! Thank you for letting me know, I’m glad to hear it!

  • @thedavidjdunn
    @thedavidjdunn Рік тому +1

    One of the clearest explainers of loops I've encountered. Loved the visuals.

  • @pfleming33
    @pfleming33 2 місяці тому

    Absolutely brilliant, was struggling with loops and updating the records outside the loop, thank you for this.

    • @employedforgood
      @employedforgood  2 місяці тому

      Thanks for the comment, glad to hear it helped!

  • @marybuchanan3313
    @marybuchanan3313 5 місяців тому

    This is exactly what I was trying to do! Thanks so much!

  • @helenecoetzee5597
    @helenecoetzee5597 Рік тому +1

    Helped me so much! Thanks

  • @mahanteshbhuyar5524
    @mahanteshbhuyar5524 10 місяців тому +1

    Clearly explained!

  • @anjilesourneart
    @anjilesourneart Рік тому

    Gosh Thank you! You just saved me a lot of time☺

  • @bheemadonthi5780
    @bheemadonthi5780 2 роки тому +2

    Awesome video mam, i had a similar scenarion (Except the date criteria) and it worked fine, Thanks loads..!

  • @dialp4penguin
    @dialp4penguin 6 місяців тому

    I sat for hours trying to figure this out, and all I needed to hear was, "just backspace that period"

    • @employedforgood
      @employedforgood  6 місяців тому

      Lol! Been there. Glad I could help with that one!😂

    • @dialp4penguin
      @dialp4penguin 6 місяців тому

      @@employedforgood You definitely could! I've stumbled upon a couple of your videos throughout my SF journey, and they've helped out so much!

  • @krishnaCasukhela
    @krishnaCasukhela Рік тому +1

    Hello Mam, You explained the concept extremely well, I have 10 opportunities whose stageName is not equal to closed Won/Lost and I am not using any date criteria. But after the flow kicks in I am seeing for under each opportunity 10 Tasks are being created instead of a single Task

    • @employedforgood
      @employedforgood  Рік тому

      Thank you Krishna. It's difficult to troubleshoot without seeing it, but I would start with the debug log. Run the debug and see 1) how many records you find in the GetRecords element, 2)how many Opportunity Ids iterate in the Loop and 3) if your final CreateRecords element is sending the correct number of Tasks to Salesforce . If it's sending multiple tasks with the same Opportunity Id, then it's something earlier on in your Flow - possibly an issue with your Assignment elements, though I can't imagine what that might be.
      Also, I assume you're using a Schedule-Triggered Flow like the one in the video. If you happen to be using a record-triggered Flow, then it's possible that separate update operations are causing your Flow to continue firing/creating Tasks. Hope some of that was helpful

  • @bhatsunayana
    @bhatsunayana Рік тому +1

    Hi! This is very helpful, thank you for the video!
    I have a question, If I want to create multiple records through flow, and the action that would trigger the flow would be click of a Button, what flow type should I use, screenflow?

    • @employedforgood
      @employedforgood  Рік тому

      Thanks @bhatsunayana! You can technically call Flows from buttons either via autolaunched or screen flow. But you probably want to prompt your users before they create those records, so I'd suggest a screen flow.

    • @bhatsunayana
      @bhatsunayana Рік тому +1

      @@employedforgood Thank you for the quick response and suggestion! Appreciate it!

  • @GregDyche
    @GregDyche Рік тому

    Great video. I see what I’ve been doing wrong; thank you. When adding the single-record variable to the collection-record variable, you point out removing the period from the value selection, so the whole record is selection instead of a single field. Is that called dot notation? How do I describe that in order to do some more research? I don’t understand why the two step process is needed: collect a single record and then add the single to the collection. Seems like I should be able to add each individual value to the collection-record in a mulit-value assignment, instead of the doing that to the single-record first. Does that make sense? Again, thank you so much for taking the time to make the video. I found it very helpful.

    • @employedforgood
      @employedforgood  7 місяців тому

      Hi Greg - first, apologies for taking so long to respond. I'm just figuring out how to keep tabs on my video comments!
      I don't believe that step (of removing the period) is considered dot notation necessarily. But to your larger question about adding records to collections vs specific values - you should definitely be able to do the latter. But that depends on how you've set up the collection variable, and more specifically, the format that you select when creating.
      So for example - if you wanted to grab just the record Id value (text), you could choose that in your Assignment and then add it to a text collection variable. But if you have a record collection variable, like I do in the video, then it only supports full records. A bit late for an explanation, but hopefully that makes sense

  • @therealbeskarlorian
    @therealbeskarlorian 2 місяці тому

    What is the formula in the Date_LastMonth date variable?

    • @employedforgood
      @employedforgood  2 місяці тому

      CASE( MONTH({!$Flow.CurrentDate}),
      1,DATE(YEAR({!$Flow.CurrentDate})-1,12,1),
      DATE(YEAR({!$Flow.CurrentDate}),MONTH({!$Flow.CurrentDate})-1,1)
      )
      Case formula that looks at the month # value for the current/flow run date.
      If the month is 1 (January), then returns December 1 of the previous year
      Otherwise, returns the 1st of the previous calendar month

    • @therealbeskarlorian
      @therealbeskarlorian 2 місяці тому +1

      @@employedforgood thanks for responding!

  • @ritamnayek5071
    @ritamnayek5071 Рік тому

    How to define boolean date variable ?

    • @employedforgood
      @employedforgood  Рік тому +1

      Hi Ritam - in the Flow, create a new resource > choose 'formula' (not variable). For the input, this is what I have:
      DAY({!$Flow.CurrentDate}) = 1
      $Flow.CurrentDate is a system variable you can find within the Flow. DAY is a function that returns the day (number format) of that flow date. The total expression checks if the Flow date is equal to 1.

    • @ritamnayek5071
      @ritamnayek5071 Рік тому +1

      @@employedforgood Thankyou. It's help me a lot 😀

  • @Trevor.Morrice
    @Trevor.Morrice Рік тому

    you didnt show how to setup the new task variable

    • @employedforgood
      @employedforgood  Рік тому

      Thanks for watching, Trevor. You can see how the Task variable is configured in this other video, that further explains how record variables work. It starts at 1;37 > ua-cam.com/video/Dh-Lt04sahE/v-deo.html