Mass Generation Configuration
Out of the box, Docomotion installs a Mass Generation button for standard Salesforce objects (Ex: Accounts, Opportunities, Leads, Contacts etc.) labeled “Mass Generation”.
You can add this button to the Layout of the List View and Related Lists for any Salesforce Object.
However, if you wish to mass generate documents from your custom Objects, you are required to add a new Mass Generation button to each custom Object.
Adding the Mass Generation Button – List View Layout
In order to mass generate documents, you need to add the new button to the List View Layout of the Object designated as the Main Object of the Form.
To add the Mass Generation button to the List View:
- As Salesforce Administrator, In the Salesforce Setup, navigate to the Object where you would like to display the button.
- In the left pane, Select the ‘List View Button Layout ‘ and ‘List View’.

- Edit it and add the Lightning Mass Generation

- Move from Available to Selected and save.

Adding the Mass Generation Button to the Related List Layout
In order to mass generate documents from related lists you need to add the new button to the Related Lists Layout of the Object designated as the Main Object of the Form.
To add the Mass Generation button to the Related Lists Layout:
4. From the Available Buttons pane select Mass Generation and click Add to add to the Selected Buttons pane.
5. Click OK.
Adding a New Mass Generation Button
You can create the Generate Document button to add to any custom Object.
To create a button for an Object:
1. In the Salesforce window, click Setup to display the In Salesforce Setup sidebar.
2. In Salesforce Setup sidebar, under Customize/Create select your Object and click the > Buttons, Links and Actions.
3. Click New Button or Link to display the New Button or Link page.
4. In the Label text box assign the button a name (Mass generation) , this will be displayed on the List View Layout.
5. From the Display Type buttons select the List Buttons display type.
6. From the Behavior dropdown list, select Execute Javascript.
7. From the Content Source dropdown list, select OnClick JavaScript.
8. In the following code replace Contact with the Object API Name you want to use and paste into the text area.
var ids = {!GETRECORDIDS($ObjectType.Contact)}; if (ids.length) { window.location = '/apex/doco__VF18_MassGenerate?ids=' + ids.join(','); }else { alert('Select one or more Contacts'); }
When using the Docomotion4CPQ package replace doco__ with doco4cpq__.
To find the API Name of your Object, go to Setup and search “Objects“.
In the Objects page click on your Object, you will then see your Object’s API Name.
Configuring the Mass Generation Expiration Period
You can change the default expiration period for the result documents stored on the Docomotion servers. Default period is 4 days. See Editing the Output Expiration Period for Asynchronous Generation.
Configuring Mass Generation from List View in Salesforce Lightning
In order to enable users to mass generate output from List View in Salesforce Lightning you need to add the Mass Generation from List View button to the Salesforce Lighting. This requires the following configuration steps:
Step 1: Create an Apex class to run Docomotion Mass Generate functionality (based on the samples)
You can easily adapt the sample classes to for any standard and custom objects, just replace the relevant strings such as account or opportunity with relevant strings as well as acc and opt.
- Open the sample class and edit it if required (you can use for example Notepad ++).
- In Salesforce Lightning go to Setup>Apex Classes click New and copy the new class to Class Body.
- Click Save. The new class is added to the Apex Classes list.
Step 2: Create simple Visualforce page to execute this class (see sample)
You can use the Visualforce capabilities in Salesforce in order to call the Apex class.
You can again use the samples provided and adapt them to the standard or custom object for which you created the Apex class.
Step 3: Create a button that calls this Visualforce page
You now need to create the button.
- In the Object Manager select the Object type for which you want to add the button (Opportunity in our example)
- In Buttons Links and Actions click New Button or Link; the New Button or Link page is displayed.
- Enter a Label for the button
- Display Type: select List Button
- Content Source: Select Visualforce Page, and from the Content dropdown list, select the Visualforce page you added.
- Click Save.
Samples
Click to download the zipped package.
- Apex Class sample for Account accListExt
- Apex Class sample for Account Test_accListExt
- Apex VF page that runs Account accListExt
- Mass Generate For Accounts Button Screenshot
Mass Generate from List View for Opportunity Sample Package
- Apex Class sample for Account oppListExt
- Apex VF page that runs Account oppListExt
- Mass Generate For Opportunities Button Screenshot