Detect when a record is being cloned in trigger

Viewed 10200

Is there a way to detect that a record being inserted is the result of a clone operation in a trigger?

As part of a managed package, I'd like to clear out some of the custom fields when Opportunity and OpportunityLineItem records are cloned.

Or is a trigger not the correct place to prevent certain fields being cloned?

I had considered creating dedicated code to invoke sObject.Clone() and excluding the fields that aren't required. This doesn't seem like an ideal solution for a managed package as it would also exclude any other custom fields on Opportunity.

3 Answers
Related