In the Opportunity object there are two custom fields called 'start_date__c' and 'stop_date__c'
I have a requirement where I need to create a flow that executes when the the Opportunity stage is Closed Won (this will be an autolauched flow executed with process builder) and create N amount of Ocupation__c records (it has a lookup to the Opportunity object) based on the difference between 'start_date__c' and 'stop_date__c' in the parent opportunity object.
So for example if 'start_date__c' = 2021-01-20 and 'stop_date__c' = 2021-01-22 the difference will be of 2 so I need to create two Ocupation__c objects.
I flow builder I've created a new variable resource of type formula that looks like this:
this formula is returning a Number (wich is the one that tells me how many days is the difference between the two dates)
Then I need to execute the flow, get the parent Opportunity record, loop over this formula returning the number and create one Ocupation__c record until the number returned by the formula is equal to 0
This is the theory .... but in the flow builder I'm not being able to do it and I don't know how to achieve this.
Any help would be more than valuable. Many thanks