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
John GallinaghJohn Gallinagh 

Trigger to Create New Contract When Opportunity is Closed Won

How would I go about writing a trigger that automatically creates a new contract when an Opportunity is Closed Won?  On the opportunity record I am collecting the information needed to setup a new contract record.  Here are the custom fields I'm using on the Opportunity Record to capture the contract dates.
  • Contract_Start_Date__c
  • Contract_End_Date__c
  • Contract_Term_Months__c
Thanks in advance....

AshlekhAshlekh
Hi,

Can you post what you have done so far so we can help you?

About Trigger
https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
John GallinaghJohn Gallinagh
I haven't even started yet... No clue on how to go about it.
abhiram vemuriabhiram vemuri
Hi Jhon,

I am too struck with the same scenario John. I think its something to work with clone and declone function but am not sure how to do it. Please post it here incase you get any kind of solution.