I've created a Schedule Trigger flow which I'm trying to get to create Renewal Opportunities with Products for all the Opportunities that meet the criteria, but it is only creating a Renewal Opportunity for the first one in the list. Can anyone point out what I'm doing wrong?
The problem I see is that you are run the flow on the Opportunity object and then doing a get opportunity inside the flow. Scheduled flows are bulkied and will run on each record, find a couple of records within the same criteria and run (bulkification).
So here are the changes you need to make this work:
1. You can remove the "Get Opportunity Fields".
When you trigger the schedule flow you are already identifying that needs to run on the Opportunity Object; therefore all the fields are already stored in the first bid box
2. Remove the Loop (Loop through Opps) and all the assignments.
So basically you will have the big box that triggers the flow connected to the "Get Opportunity Products line items" (which should be filtered based on the Opportunity Id found on the first big box $Record > Id). Then that get record will be connected to the "Create Opportunity". You will only create one opportunity record. Make sure you manually assign the newly created Id (store that Id in a variable)
3. Now create a loop (loop through Opportunity Products)
4. Add an assignment to assign the variables. Here you will take the chance to assign the opportunity product to the newly created opportunity. You may need to specify the fields are you cannot add the total price and the unit price at the same time. You either assign one or the other
5. Add an assignment to add the single variable to a collection. You will need to create a new resource
Type: Resource / Record / Opportunity Product Lines
Available for input and output
Check the checkbox for multiple records
I'll call this COL_OpportunityProducts
Your assignment should be something like:
COL_OpportunityProducts Add Current.Loop.OpportunityProducts
Connect the loop to the first assignment, the first assignment to the second assignment and the second assignment vack to the loop
6. Drag a Create element
And select the COL_OpportunityProducts to create all the opportunity products
Connect the loop to this create element
Now you are done!
If you are still not sure this flow will give you an idea: https://krisneyris.wixsite.com/sayforce/post/clone-quote-with-quote-line-items
It's triggered from a screen but what matters to you is how to clone the line items, assign them to the new record and mass create them
Basically whatever comes after this is what can help you if you are stuck:
Otherwise, ping me. Happy to help