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
Arash Rah 5Arash Rah 5 

Flow to generate renewal opportunity

Hi,

I want to create a record triggered flow for renewal opportunity so that the it will be closed one year from close date when an opportunity is closed won.
I need to consider the leap year too. Also, the opportunity name should be like this: [opportunity name] - Renewal [renewal count] - year.
For example,
Ford - Renewal 1 - 2024
Ford - Renewal 2 - 2025
Etc.
 
Soyab HussainSoyab Hussain
Hi Arash,

Hope this will work for you:
  1. Navigate to Setup > Process Automation > Flows, and click the “New Flow” button.
  2. Create a new “Record-Triggered Flow”, and select Opportunity as the sObject.
  3. Add a decision element to check if the Opportunity Stage is “Closed Won”.
  4. If the Opportunity Stage is “Closed Won”, use the “Create a Record” element to create a new Opportunity with the following fields:
    Opportunity Name: Concatenate the Opportunity Name, “ - Renewal ”, the number
  5. Create a Decision element, Create a Decision element.
    In the first formula field, enter the formula above.
    In the second formula field, enter "365".
    In the third formula field, enter "366".
  6. IF(MOD(YEAR(CloseDate), 400) = 0, true, IF(MOD(YEAR(CloseDate), 100) = 0, false, IF(MOD(YEAR(CloseDate), 4) = 0, true, false)))
  7. In the Formula element, use the "Opportunity Close Date" and the output from the Decision element to calculate the correct renewal date.
  8. Use an assignment element to update the renewal count field on the original Opportunity.
  9. Save and activate the flow.

With this flow, when an Opportunity is marked as “Closed Won”, a new Opportunity with a calculated Close Date and updated Opportunity Name will be created automatically.

If you found it useful please appreciate my efforts and mark it as the best answer.

Regards,
Soyab
Arash Rah 5Arash Rah 5
Hi Soyab,
Thank you for the answer. I am a bit new to this and lost track of you in the part 4.
Am I correct in the value?
In the part 5, should I again create a decision element? Where should I write a formula?
I was wondering if you could show me the answer with the pictures.
User-added image
Soyab HussainSoyab Hussain
We can connect over here, and look into this.

https://www.linkedin.com/in/soyab-hussain-b380b1194/ (https://www.linkedin.com/in/soyab-hussain-b380b1194/)