Skip to main content
Tweeted twitter.com/StackSalesforce/status/744429901525164032
edited tags
Link
Mr.Frodo
  • 5.9k
  • 1
  • 18
  • 38
added 52 characters in body
Source Link
Mr.Frodo
  • 5.9k
  • 1
  • 18
  • 38

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.

  2. User selects either 'Clone without products' or 'Clone with Products'

  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

    trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } }

     trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } }} 

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. 

It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.

  2. User selects either 'Clone without products' or 'Clone with Products'

  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

    trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } }

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.

  2. User selects either 'Clone without products' or 'Clone with Products'

  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

     trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } }} 

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. 

It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.

    User clicks on standard Opportunity clone button.

  2. User selects either 'Clone without products' or 'Clone with Products'

    User selects either 'Clone without products' or 'Clone with Products'

  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products).

    On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

    I started off with a simple trigger like this:

    trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } }

trigger OpportunityClone on Opportunity (before insert) {

for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } 

}

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.
  2. User selects either 'Clone without products' or 'Clone with Products'
  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

trigger OpportunityClone on Opportunity (before insert) {

for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } 

}

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

I have spent hours on it but haven't been able to figure out anything. The idea is simple:

  1. User clicks on standard Opportunity clone button.

  2. User selects either 'Clone without products' or 'Clone with Products'

  3. On the cloned record, the stage is set to Identified (first one) and certain custom fields are cleared out (doesn't matter if it's with or w/o products). I started off with a simple trigger like this:

    trigger OpportunityClone on Opportunity (before insert) { for (Opportunity o : Trigger.new) { if (o.isClone()) { o.StageName = 'Identification'; o.IsCloned__c = true; o.Roll_Out_Plan__c = NULL; o.Rollout_Duration__c = NULL; o.Roll_Out_Start__c = NULL; o.External_Opportunity_ID__c = NULL; } } }

But for some weird reason, it works perfectly for the 'Clone With Products' button action but doesn't do anything for 'Clone Without Products' action. It seems like the isClone() isn't being detected at all when doing the latter.

Is there a way to fix the above or an alternative better way? Any help is much appreciated. I have pulled my hair enough on this.

Source Link
Loading