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
Chinna SfdcChinna Sfdc 

New_Trigger Help

Hi All,

We have requirement as mentioend below senario:

How to create/generate a new Opportunity with Related Lists to be populated on new Opportunity from Old Opportunity based on the closure of  ContractEnd date  of a existing opportunity.

Can any one please help us to create a new trigger.

Thanks in Advance
 
VIGNESH BALASUBRAMANIANVIGNESH BALASUBRAMANIAN
I could n't get you.Can you explain in detail
Chinna SfdcChinna Sfdc
Hi Vignesh,

Thanks for your reply.Actually we want to create a new trigger when before 120days closure to END DATE.Let's say we have one field called as "ENDDATE".

ForExample: Opportunity created date = 8/2/2016 and ENDDATE is 11/27/2016 so closure of current opportunity. we need to create a new opportunity along with same data.

Can you please help me on this.

Thanks in Advance 
Poornima HR 5Poornima HR 5
Hi Chinna,

Do you want to create duplicate opportunity when the old one is closed?
Chinna SfdcChinna Sfdc
Hi Poornima,

Yes.When opportunity Enddate is closed before that i need to create newopportunity for the same.

Can you please help me on this.

Thanks
Poornima HR 5Poornima HR 5
Hi Chinna,

I undertsand that when the Opportunity is closed, you need to create a new one. You can create an after update trigger, clone the original opportunity, save the original Id in the new one and insert it. You may need to create a new field to capture the original Opportunity Id in the new one.

Thanks
VIGNESH BALASUBRAMANIANVIGNESH BALASUBRAMANIAN
Hi Chinna,

You dont Need Apex code.Simply,Process Builder (Scheduled action) is enough to done this task.Refer Following Screen shot....

1)  Open Process builder and Choose opportunity as traget object and select "Only when a record is created".

User-added image

2) Set entry criteria as "No Criteria - Just Execute actions"

User-added image

3) In scheduled action set criteria as " 120 days before End_Date"

User-added image

4) Then "Add Action" under scheduled action to create new opporunity(Map all fields(whichever is required) as below)..

User-added image

5) Finally "Activate" the Process Builder and Check it.


Let me know the result......

Thanks & Best Regards,
Vignesh.B

 
VIGNESH BALASUBRAMANIANVIGNESH BALASUBRAMANIAN
@ chinna ,

Schedule action is here

User-added image