• Lawrence Coffin
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
This idea: https://success.salesforce.com/ideaView?id=08730000000BrGFAA0 -- "isClone() within trigger" -- was posted seven years ago and was recently closed as being delivered in Winter '16. Does anyone know how it was delivered? Does anyone know how to do what the asker was asking for?

I'm aware there is a new sObject.isClone() method that was delivered in Winter '16, however that doesn't appear to work with records cloned in the UI, just records cloned within Apex using the sObject.clone() method. Same thing for the sObject.getCloneSourceId() method -- works if cloned via Apex, but not within the UI even though the documentation explicitly states "You can use it for objects cloned through the Salesforce user interface."

Or am I missing something? My trigger is using the latest Apex version (37.0). Has anyone been able to get this to work for records cloned in the UI?

Thanks,

-L
Hi Guys

when I am cloning from UI by clicking "clone" standard button, Its returning :false. On the other hand if I am doing it from APEX its returning " True".

lead c = new lead(id='00Q9000000xfFHVEA2');
lead cd = c.clone();
system.debug(cd.isclone());

USER_DEBUG|[5]|DEBUG|true

Does anyone know how to identify a new reocrds was cloned from UI in apex.
 
When serializing Apex objects, JSON.serialize() still includes null class variables even though the documentation seems to claim this was fixed back in Apex version 28. (I've tested with versions up to the current version -- 36)

Example Apex class:
public with sharing class xtmp_TestJSON {
    public String SomeText;
    public String SomeOtherText;
}
and test JSON.serialize() using:
xtmp_TestJSON req = new xtmp_TestJSON();
req.SomeText = 'Hi';

System.debug('====> data: ' + JSON.serialize(req));
Output is:
====> data: {"SomeText":"Hi","SomeOtherText":null}

Any suggestions on how to "fix" this?

Thanks,

-L

 
Hi, guys.

I have a strange problem here, which really pisses me off :(

So it is very simple, just typing in execute anonymous:
Account acc;
acc.getCloneSourceId();

Gives me an error:
"Compile error at line 2 column 1
Method does not exist or incorrect signature: [Account].getCloneSourceId()"

According to this (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm)article, this method should work with any SObject, but it doesn't work with any object...
Please, tell me what am I missing.



Thanks!
  • October 16, 2015
  • Like
  • 0