So, Uh, What the Heck Happened? Lists and For Each Loops

Here’s how the code runs its course:

  • We created a map for the commission record with the amount, name, and related Deal
  • We created a list with the two IDs of both the Deal Owner and the Financial Advisor
  • Then, we use a ‘For each’ loop that carries out an action for each element of the list
  • In that action, we put the ID in the list into the “Commission Owner” field and then create a commission record
  • So, that ‘For Each’ loop creates separate commission records for both people involved in the deal, with their correct commission amount and related Deal