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
ani123ani123 

deep clone help!!!!!

hi can any one help me with deep clone based on input given.

For example:

no of copy to clone(numberfield):3

i have to clone 3 copy of records

bob_buzzardbob_buzzard

Can't you just iterate based on the number field?  E.g.

 

// assuming you are cloning the account called myAcc the number of
// times contained in the property 'cloneCount'

List<Account> clones=new List<Account>();
for (Integer idx=0; idx<cloneCount; idx++)
{
   clones.add(myAcc.clone(false, true, true, false);
}