Overview

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.

To use mass generation you need to authorize Docomotion to update Salesforce data. Only a user authorized to update Salesforce data can perform this step. See Authorize.

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 configure Mass generation from List View in Salesforce Lightning see Configuring Mass Generation from List View in Salesforce Lightning.

To add the Mass Generation button to the List View:

  1. As Salesforce Administrator, In the Salesforce Setup, navigate to the Object where you would like to display the button.
  2. In the left pane, Select the Search Layout.

5. Click 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.

Mass generation from Related List is not supported in Ligtning.

To add the Mass Generation button to the Related Lists Layout:

  1. As Salesforce Administrator, In the Salesforce Setup, navigate to the Object where you would like to display the button and select a specific Object.
  2. Enter the object (for example Accounts) layout for editing.
  3. In the Related Lists area, click the Related List Properties icon .

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');
}
Docomotion4CPQ Package:
When using the Docomotion4CPQ package replace doco__ with doco4cpq__.
Tip:
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.

Example for Contact:
Mass-Generation-Add-Button
9.  Click Save.

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:

In the example, we will add the button to the Opportunity object.

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.

  1. Open the sample class and edit it if required (you can use for example Notepad ++).
  2. In Salesforce Lightning go to Setup>Apex Classes click New and copy the new class to Class Body.
  3. 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.

  1. Go to Visualforce pages and click New.
  2. Name the page and copy the edited text of the sample.
  3. Click Save.

Step 3: Create a button that calls this Visualforce page

You now need to create the button.

  1. In the Object Manager select the Object type for which you want to add the button (Opportunity in our example)
  2. In Buttons Links and Actions click New Button or Link; the New Button or Link page is displayed.
  3. Enter a Label for the button
  4. Display Type: select List Button
  5. Content Source: Select Visualforce Page, and from the Content dropdown list, select the Visualforce page you added.
  6. Click Save.

Step 4: Add the Button to the Search Layout of the Object

  1. In the Object Search Layouts go to List View (in the example Opportunity>Search Layouts>List View)
  2. In the Available Buttons pane, select the new button and click Add to add it to the Selected Buttons pane.
  3. Click Save.

Samples

Click to download the zipped package.

Mass Generate from List View for Accounts Sample Package (with test sample class for moving to Production)

  • 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