Super Clone Pro
List View Mass Clone Setup
Clone multiple records at one time from a List View. Leverage the flexibility and filtering of native Salesforce List Views in conjunction with Super Clone Pro’s mass clone functionality. Follow the steps below to connect Super Clone Pro to your object’s List Views.
- Create a Clone Configuration
- Create a Visualforce page that references the primary object
- Create a Custom Button
- Add the Custom Button to the List View Layout
- Try It Out
Create a Clone Configuration
The configuration controls cloning behavior. It specifies which object and child relationships are cloned, and it allows you to set or clone values for fields. Find more detail about creating a configuration on the Configuration Settings page.
Create a Visualforce Page
Creating a three line Visualforce page is required for us to pass selected records from a List View into the Super Clone Pro Mass Clone component. Here is an example for an Opportunity.
The Visualforce page references a ‘StandardController’, Super Clone Pro controller ‘extension’, record set variable, and the Mass Clone Visualforce component.
- The StandardController tells the page it will be processing records for a specific object type.
- The Record Set variable attribute tells the page multiple records may be processed.
- The Super Clone Pro controller extension includes logic to retrieve the selected records from a List View.
- The Mass Clone component runs the clone logic for the selected records.
Create a Visualforce page, and update the object name referenced in the ‘StandardController’ attribute with your primary object’s API name. Everything else can stay the same.
<apex:page lightningStylesheets="true" standardcontroller="YourObjectNameHere__c" extensions="lcrm_scp.ScpMassCloneController" recordSetVar="rsv"> <lcrm_scp:ScpMassClone MassCloneRecordIdList="{!RecordIdList}" /> </apex:page>
Create a Custom Button
Create a custom button on the primary object.
- Set ‘Display Type’ to ‘List Button’
- Check the ‘Display Checkboxes (for Multi-Record Selection)’ checkbox
- Set ‘Behavior’ to ‘Display in existing window without sidebar or header’
- Set ‘Content Source’ to ‘URL’
- Enter the URL to load the Visualforce page that was created in the last step
URL Parameter Options
The Visualforce component within the page will look for a few URL parameters when the page loads.
Required Parameters:
- cfg – The name given to the configuration.
Optional Parameters:
- batchsize – The batch size controls how many records are cloned in one transaction. This is used to prevent View State errors if a set of records contain more data than can be handled in a Visualforce page at once.
- saveURL2 – This is a URL encoded string that references a custom page to navigate to after the clone operation completes.
- retURL2 – This is a URL encoded string that references a custom page to navigate to after the cancel button is pressed.
- multiplyclonepage – Add ‘multiplyclonepage=1’ to the URL. This allows a clone multiplier to be specified to clone each record multiple times. One multiplier value is entered at the top of the page.
- multiplyclonerec – Add ‘multiplyclonerec=1’ to the URL. This allows a clone multiplier to be specified to clone each record multiple times. Each record allows a separate multiplier to be entered.
- requeryresults = Add ‘requeryresults=1’ to the URL. This will query the cloned records to retrieve the new record name for the list. This is used when flows or triggers update the name, so the updated record name can be displayed in the list.
/apex/YourNewVisualforcePage?cfg=YourConfigName&batchsize=15
Add the Custom Button to the List View Layout
Navigate to the primary object’s ‘Search Layouts’ related list. Edit the the ‘List View’ layout.
You’ll be presented with a page to select buttons to display on the List View. The button created in the prior step should show as an option. Select the custom button from the ‘Available Buttons’ list, move it to the ‘Selected Buttons’ list, and save.
Check the checkbox next to items that you wish to clone, and click the clone custom button.
You will be redirected to the mass clone page. This page will show records that you selected, and fields from the primary object. The clone configuration controls which fields are displayed. Fields with the ‘Display’ checkbox checked will appear on the page, and fields that also have the ‘Edit’ checkbox checked will be editable.
Click the ‘Confirm Clone’ button to clone the batch of records. If you have selected more records than your batch size, the next batch of records will appear for cloning. Otherwise, you will be presented with a list of links to the new records.
Clicking the links will open the records in new tabs. Click the ‘Return to List View’ to go back to the primary object’s tab.