How To: Use conditional logic to control the logic of the Custom ButtonMarch 31, 2017
How To: Clone a Parent Object and Move Child Records to the New Parent ObjectMay 25, 2017
New Opportunities and Quotes in Salesforce are often similar to ones that already exist. Salesforce has the ability to clone an existing Opportunity with Products, but the ability to set values or include other relationships is missing. Super Clone Pro excels in this area because it gives you the ability to set field values and clone multiple relationships up to four levels deep.
You have control of the cloning process with Super Clone Pro. We will focus on cloning an Opportunity with it’s related Quotes and Quote Line Items in this ‘How To’. Opportunity Partners, Opportunity Products, Product Schedules, Contact Roles, Attachments, and other custom object relationships can also be included when cloning the Opportunity.
We will follow these four steps to clone the Opportunity with Quote and Quote Line Items. The screen captures are from Lightning Experience, but this also works with the Classic user interface.
Create the Configuration
First we create configuration that defines the cloning behavior. Go to the Super Clone Pro Configuration tab, and click the ‘New’ button at the top of the page.
Enter the name of the configuration, and select the primary object that will be cloned. The configuration name will be referenced in the custom button. We selected the Opportunity as the primary object for this cloning example.
This is the configuration page where record relationships are displayed that will be cloned with the opportunity. Clicking on the ‘Clone’ button next to the Relationship Tree section will display a window where you will be able to select child relationships.
This Relationship popup window will show relationships for objects that you have permission to access. This includes standard and custom object relationships. Check the checkbox next to the objects and click the ‘Submit’ button.
The selected object relationship will appear in the Relationship Tree. You will be able to click the ‘Clone’ button on the new object to select it’s child relationships.
Here we are selecting only the Quote Line Items to clone.
A set of fields will appear in the Field Section for each selected relationship. Click the name of a field section to expand or collapse the display.
Select fields to display on the clone confirmation page by checking the checkbox in the ‘Show’ column, and set the sequence in the ‘Display Order’ column. The default is for a field value to be cloned, but this is where you can set the fields to have new values when they are cloned.
- The ‘Stage’ field is set to a constant of ‘Prospecting’ for new record.
- The ‘Close Date’ uses an Action Formula List that will set the value to one month after the current date.
- The SyncedQuoteId field is set to empty, so it doesn’t reference a quote from the original Opportunity.
See the Configuration Setting page for more information on setting field values.
Remember to Save.
Create the Custom Button
A custom button is used to navigate from the Opportunity’s record page to the Super Clone Pro cloning page. Go to the Opportunity object in the Setup menu, and create a URL custom button.
- Select ‘Display in existing window without sidebar or header’ as the Behavior.
- Select the ‘Detail Page Button’ as the Display Type.
The URL of the custom button will reference the Opportunity record Id and configuration name.
See the Clone Page and Custom Button Settings documentation for more URL parameter options.
Add the Custom Button to the Page
URL Custom Buttons will appear in the Record Highlights section of a Lightning Page. We need to add the custom button to the Opportunity Page layout.
Then we need to confirm that the Opportunity Lightning Page references the page layout with the custom button.
We are ready to clone. Find an Opportunity record, and click the Super Clone Pro cloning button.
You should see the Opportunity -> Quote -> Quote Line Item hierarchy. Click the ‘Save’ button at the top of the page to create the new records.