Hello, I have a trigger on the Opportunity that creates records on a custom object called the Opportunity_Revenuec. It takes the revenue from the Opportunity and spreads it out over the quarters during the length of the deal. It works fine for insert triggers, I need to have the ability to let users re-create based on a changing contract length / deal length. So when the record is updated I want to delete all the records in the custom object Opportunity_Revenue__c that are related to the Opportunity and then run the insert code to create the new records for the Opportunity_Revenuec object. But it is doubling the records because once it deletes the old records it see trigger as an update and an insert.
Can you help or suggest what I might do? I didn't find the right solution from the internet. References:https://developer.salesforce.com/forums?dc=Apex_Code_Development#!/
CMS Video Examples