How can I differentiate between copied Opportunities and Opportunities created using Create button?

You can create a Groovy script to help you identify opportunities that were copied from those opportunities that were created using the Create button from the UI.

Here's how.

  1. Navigate to the Opportunity object in Application Composer.
  2. Create a custom filed called OptyIdCopyText and enter the expression getAttribute(OptyId)exp as its default value.
  3. From Server Scripts area, insert the following sample Groovy script before the insert trigger. This scripts differentiates between copied Opportunities and Opportunities created using Create from the UI.
    if(OptyId.toString().equals(OptyIdCopyText_c)){
    
    return false
    
    }
    else
    {
    setAttribute('DateatSalesStage1_c',null)
    setAttribute('DateatSalesStage2_c',null)
    setAttribute('DateatSalesStage3_c',null)
    setAttribute('DateatSalesStage4_c',null)
    setAttribute('DateatSalesStage5_c',null)
    setAttribute('DateatSalesStage6_c',null)
    
    }
     
  4. Click Save and Close.

For more information about groovy scripting, see the Oracle Applications Cloud Groovy Scripting Reference.