function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicole SackinNicole Sackin 

Creating different Opportunities based on Product date via Flow

Hello

I have a currently flow in my Salesforce environment that we use to create Maintenance renewal Opportunities.  It is based on the one here (https://automationchampion.com/tag/copy-opportunity-line-items/)

However, I would like to update it so it will create different opportunities based on the expiration date of the product in the original opportunity.

In other words: If an Opportunity closes and Product A is due to expire in July and Product B is due to expire in September, two opportunities should be created.  My flow seems to be creating the Opportunities ok, but, I'm having a hardtime getting the products to going into their respective Opportunities.  All the products are going into the first Opportunity.

I've attached a screenshot of my current flow.  Does anyone have any idea where I may be going wrong?User-added image
NagendraNagendra (Salesforce Developers) 
Hi Nicole,

May I suggest you please find the below suggested solution from the success community.

In order to make Opportunities be dependent on the number of products and expiration dates, a Decision point has to come before the first task to create a new Opportunity. and that's where the process should end as well. (that way you can make as many Opportunities as you need (however many have different expiration dates)

The Decision I am using is whether the SOC_OLI (the Opportunity Line Item Collection variable I am running through the Loop) is not the same as the variable I created from the positive outcome of the Decision point in the Loop.

Also, that should be the only time that you create a new Opportunity.

Here is the completed flow:
User-added image

Hope this helps.

Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra