Skip to main content
Hi,

I have a scenario like,i would like clone a record of standard object but i dont want all the fields to be come in through cloning, i want to choose specific fields from the record and clone,how could i achieve this,

your answers and suggestions will be highly appreciated,
답변 3개
  1. 2015년 3월 19일 오후 4:27

    You can create new object of the same type as your standard obj and add each field by hand:

    //standard account obj we want to clone

    Account accToClone = [SELECT Name, SomeOtherField FROM Account Limit 1];

    //new account obj

    Account acc = new Account();

    acc.Name = accToClone.Name;

     
0/9000