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
Jos Vervoorn 2Jos Vervoorn 2 

How to identify opportunity is clone (with related)

We have custom apex trigger running on Opportunity Line item. This will generate line item schedule for any given line items matching conditions.

The Clone opportunity with related function also allows to clone opportunity with products and schedule .... so when using this function my trigger kicks in and creates a secundairy schedule which .. will give twice the revenue .... Now I would like to prevent the trigger from firing but then I need to know if the opportunity is created by this function. 

So .. is there a way to determine the opp and it's items are created thru this function ...
 

ANUTEJANUTEJ (Salesforce Developers) 
Hi Jos,

This is just an idea that I could think of is to have a field that could mention if the record is created by function or you could have a checkbox that could indicate if the record is created by the function.

I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be useful for others in the future.

Regards,
Anutej