+ Start a Discussion
ndrannapareddyndrannapareddy 

Clone Record

Hi ,

I need to Clone a Record and once i clone i need the new record to have all fields carried and input the record Id from which it is cloned  ??

 

 

Please help me out with this very Urgent need

Best Answer chosen by Admin (Salesforce Developers) 
SRKSRK

You just need to put the Record Own Id into the exsting record only onces

u can use developer consol to update all the exsting records

 

Then when ever you clone a exsting record & try to create e new record out of it salesforce automatically copy the value from the parent record

 

 

example

u have a record say Rec1(alredy exsting record in u r org) having a ID 12345  , now you just update it'sown id into a field name say "clone_from__c" ok so for record Rec1 clone_from__c = 12345 ok

 


now u try to create a Rec2 from clone functionality when you click on clone button

for Rec2  "clone_from__c" is populated from Rec1 (i.e. 12345)

 

 

 

 

 

All Answers

SRKSRK

sry plz explane the question

SRKSRK
You want to clone one after another in a continuation manner


steve456steve456

Please create a custom clone button and write the formula with the id's of each of these fields through view page source .

 

If you have "n"  record types make sure  create" n " clone buttons with different api s and add this clone button to the page layout

SRKSRK

u can try this

 

a0190000000Y1F9 will be the id of the record which u want to clone

 

https://<salesforce instance>/a0190000000Y1F9/e?clone=1

ndrannapareddyndrannapareddy

say I have Account Record and i have info all custom fields.

 

I wanted to clone the record [With Out User Having to type all fields]. But the clone record should have a reference from Where it is cloned . ?

 

Example My Loan Record Id is K003ksdkhj***** .

 

I am cloning this record to a new record and will have to have the History from where it is cloned ?

ndrannapareddyndrannapareddy

How do i store that my New Record so that i can refer it in future ...

 

SRKSRK

create a field on u r record say clone from ok

for expample currently you have 100 record in your org ok

Update the new filed (i.e clone from) from the record own id

 

then when ever u clone any recod from the existing reocrd salesforce automalically clone the clone from field from org reocrd to new clone record

 

 

example u have Rec1 with ID as 12345 then u update the update new filed (i.e clone from) with this 12345 (i.e. is the ID of the same record)

 

now u clone Rec1 to create Rec2 salesforce clone every field from Rec1 to Rec2 it will also clone new filed (i.e clone from) from Rec1 to Rec2

& when u save Rec2 it have the Id of Rec1

 

and also for dirctly creating record from new button u can write a small trigger
like this

 

trigger test(before insert)

{

if(clone from == null) // clone from field will be blank if u try to create a record from new button

clone from = trigger.new[0].id;  //

}

ndrannapareddyndrannapareddy

I am sorry I dint get you ..

 

If i put the Record Own Id the new one will have its own (Self Id ) How do i build it ?

 

 

Vinny12Vinny12

SRK,

 

What if we dont want such field ( Clone From) visible in Record1?

SRKSRK

You just need to put the Record Own Id into the exsting record only onces

u can use developer consol to update all the exsting records

 

Then when ever you clone a exsting record & try to create e new record out of it salesforce automatically copy the value from the parent record

 

 

example

u have a record say Rec1(alredy exsting record in u r org) having a ID 12345  , now you just update it'sown id into a field name say "clone_from__c" ok so for record Rec1 clone_from__c = 12345 ok

 


now u try to create a Rec2 from clone functionality when you click on clone button

for Rec2  "clone_from__c" is populated from Rec1 (i.e. 12345)

 

 

 

 

 

This was selected as the best answer
SRKSRK

I that case you need to write a VF page & over ride the clone button

 

or you need to write a trigger in whcih you need to check that if a record is created from using slaesforce standard clone button u have to update the field by trigger

 

U can check the record is creted by slaesforce standard clone functionaly by looking into URL