I have a record collection for Object A, which I loop over and for each record in that collection I create a new record for object B. These records are assigned to a second record collection.
At the end of the loop I create the records from the second record collection.
I now want to use the ID's from the newly created records and update the existing records, so that they have a lookup to these newly created records.
I'm struggling to understand, how I would iterate over the second record collection (i.e within a loop) which now has established ID's per record, and at the same time, iterate over the first record collection so as to assign the corresponding ID of the new record, to the existing record from the first collection set.
i.e
Collection Set A Record 1A Record 2A
Collection Set B Record 1B - Linked to Record 1A Record 2B - Linked to Record 2B
I attempted to access the first loops 'loop variable' in the second loop so as to set the ID, but I realise now, you can only access a loop variable within that specific loop.