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
VarunCVarunC 

Does sObject IsClone() only works in Classic Aloha interface but not in Lightning Experience?

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
 
VarunCVarunC
I have now tested in in different orgs as well, same behavior, is it a bug in platform? Because documentation has no mention of isClone() to be working differently in Aloha and Lightning environments...
Lucas Buyo 37Lucas Buyo 37
Same issue here, and looks like there is no workaround right?
VarunCVarunC
Yes i could not find any workaround for this except. Strangely no one from salesforce team confirm this as bug or known issue. On Tue, 13 Dec 2016 at 4:21 PM, Salesforce Developer Community < noreply@developerforce.com> wrote: > Lucas Buyo replied to your question at 4:21 PM on 12/13/2016. > > > > *Original question:* > > > 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 > > > > > > > > *Reply:* > > > Same issue here, and looks like there is no workaround right? > > > > > > Tip! To respond, either reply to this email or click this link: > https://developer.salesforce.com/forums/ForumsMain?id=9060G000000Xf7s > > --
mburdmanmburdman
Same issue here and couldn't find advice or at least confirm is a well known issue from any SFDC member.

I just found this that might be related: https://success.salesforce.com/issues_view?id=a1p3A000000IYveQAG