Print this page

How to clone opportunity (or any record) excluding specific fields?

Knowledge Article Number 000230954
Description How to clone opportunity (or any record) excluding specific fields?
Resolution We can clone opportunity (or any record) excluding specific fields by creating a button.

1. Go to Setup > Customize > Opportunities > Buttons, Links, and Actions
2. Click on "New Button or Link"
3. Select the settings as per below


4. Enter the below code in the editor
5.Replace Field_ID with the IDs of the fields to be excluded separated by "&"
eg /{!Opportunity.Id}/e?clone=1&retURL=/{!Opportunity.Id}&CF00N34000005WJL5=&CF00N34000005WJL5=
6. Click on the "Check Syntax" button and verify that there is no error.
7. Click on save button.
8. Go to the Setup > Customize > Opportunities > Page Layout
9. Click on "Edit" next to page layout on which you want to add the button.
10. In the palette of the page layout editor, click on the "Buttons" element.
11. Select the newly created button and drag it to the "Custom Buttons" area on page layout.
12. Save the page layout.

* Clone Opportunity with Line Items

To clone with opportunity with Line Items simply add "cloneli=1" to the URL we have created.
Eg. /{!Opportunity.Id}/e?clone=1&cloneli=1&retURL=/{!Opportunity.Id}&CF00N34000005WJL5=&CF00N34000005WJL5=
* For the fields which are still not being excluded add the HTML tag ID of the field
  e.g. for the field "Description " the HTML tag ID is "opp14"
*For the Lookup fields
Add the Field_ID and its Field_ID_LKID (obtained from the HTML Tag of the field)
e.g. If the field ID for the "Sample" lookup field is "CF00N34000005WJL5" then the LKID is "CF00N34000005WJL5_lkid"
We can use it as

promote demote