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
BA_AdminBA_Admin 

Cloning the records

Hi Guys,

 

              I have small question regarding cloning the records, when you clone any record how do you know if the record is cloned or if it is created manually,is there any sort of flag or something placed on recored when you clone or what is the way to know if it is created by clone button, and if we clone any record is there any way to restrict some fields while cloning, for example we have a field called Amount in Opp and it has some value but when you clone the record you want to clear that field....................Any kind of help is appreciated

Best Answer chosen by Admin (Salesforce Developers) 
CoryCowgillCoryCowgill

Unfortunately there are no flag or system fields telling you something was created from a clone. There is no built in admin functionality to specify which fields to clone.

 

There are ideas posted on the idea exchange request that functionality, but it has not been implemented (http://sites.force.com/ideaexchange/apex/ideaview?id=08730000000BpUXAA0).

 

I know you don't want to have to override the clone, but its the only way to achieve your requirement that I know of. Here is a more detail example http://community.salesforce.com/t5/General-Development/Custom-Clone-Opportunity/m-p/110610

 

The only way currently to do what you want would be to create a custom checkbox field on the Object you are cloning, and overwrite the clone button.

 

Good luck!

 

 

All Answers

CoryCowgillCoryCowgill

You can overwrite the default Clone button functionality. Go to the object setup, and look at the 'Standard Buttons and Links' subform. Click edit on the Clone button entry. You can make this point to a new VF and Controller which would extend the current controller. Then inside your extended controller you can modify your object however you want before you do the insert.

 

Here is documentation link from Developer Guide about writing your custom / extended controllers.

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_controller_def.htm|StartTopic=Content%2Fpages_controller_def.htm|SkinName=webhelp

BA_AdminBA_Admin

Hey cory,

 

               I don't want to override the clone button with VF page, when i clone any record how to know that the record is cloned and when you clone any record  is there any way to reset certain values for fields.

 

Thanks

CoryCowgillCoryCowgill

Unfortunately there are no flag or system fields telling you something was created from a clone. There is no built in admin functionality to specify which fields to clone.

 

There are ideas posted on the idea exchange request that functionality, but it has not been implemented (http://sites.force.com/ideaexchange/apex/ideaview?id=08730000000BpUXAA0).

 

I know you don't want to have to override the clone, but its the only way to achieve your requirement that I know of. Here is a more detail example http://community.salesforce.com/t5/General-Development/Custom-Clone-Opportunity/m-p/110610

 

The only way currently to do what you want would be to create a custom checkbox field on the Object you are cloning, and overwrite the clone button.

 

Good luck!

 

 

This was selected as the best answer
BA_AdminBA_Admin

Thanks for the link..