Generate Documents from List View

In addition to generating documents from specific records in Salesforce, you can also generate documents from a List View of records.  To do this, you'll need to:

1. Setup a List View button

Standard Object: Under Setup > Customize, pick the object you want to add the button to and go to the Buttons, Links and Actions page. 

Custom Object: Under Setup > Create > Objects, pick the object that you want to create the button for and scroll down to the Buttons, Links, and Actions section.

Go ahead and create new button. 

- Type: List View Button

- Behavior: Execute Javascript


2. Add Javascript for the button

To trigger the merge, you'll need to add this javascript:

var records = {!GETRECORDIDS($ObjectType.Account)};
sforce.apex.execute("webm.WebmergeGenerator", "generateDocumentBatchJS", {
    sfObjectIds: records,
alert('The documents have been generated!');

To find the "Mapping ID" (wmMappingId), open up the WebMerge Mappings tab and Edit one of your mappings.  In the URL of the page, you'll find the ID you need to use.  Make sure to edit the Object Name (ie "Account") to match your object type.



3. Add button to the Page Layout

To add your button to the List View page, open up your Search Layouts and then find the List View layout.  Click edit and you'll see an option to add your button to the layout.



Other Available Functions

  • generateDocumentJS(wmMappingId, sfObjectId, sfObjectName
  • generateDocumentBatchJS(wmMappingId, sfObjectIds, sfObjectName)
  • generateDocumentBatchCombinedJS(wmMappingId, sfObjectIds, sfObjectName)
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk