• Lucas Buyo 37
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
I've created an Apex trigger on CustomObject_A__c, it is working fine when I clone a record in Classic Aloha interface, but the trigger does not return True for isClone() sObject function call, when I try to clone record in Lightning Experience.
trigger CustomObjectTrigger on CustomObject_A__c (before insert, before update)
    if (trigger.isBefore)
        for (CustomObject_A__c a : trigger.new) {
            system.debug('@@ (isCloned): '+a.isClone());
            system.debug('@@ (clonedFrom): '+a.getCloneSourceId());

Debug output in Lightning Experience:

10:01:02.0 (26981116)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): false
10:01:02.0 (27065138)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): null

Debug output in Classic Aloha:

10:06:54.0 (7464346)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): true
10:06:54.0 (7542087)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): a0b9000000FxSYMAA3

As you can see, the bug validates my cause that trigger was able to identify properly a Cloned record in Classic interface but not in Lightning Experience. Is this a Known Bug/Issue?

I've found that this isClone() function was introduced in Winter '16 - isClone function added to apex code in Release Notes also, when we scroll down to Bottom of these release notes, we can find this Idea mentioned as Delivered - Idea - Detect isClone() within Trigger
  • November 08, 2016
  • Like
  • 0