PDF Butler allows users to generate documents directly from Salesforce records using a custom button. The button calls PDF Butler through a URL, passing the required record and document configuration information to generate a document.
This guide explains how to configure a custom button for use in Salesforce Lightning or Classic and generate a document directly from a record.
Step 01: Create a Custom Button in Salesforce #
1. In Salesforce, navigate to Setup and open Object Manager.
2. Select the Salesforce object where you want to add the document generation button.
3. In the left-hand menu, click Buttons, Links, and Actions.
4. Click New Button or Link to create a custom button.
5. Enter a Label and Name for the button. In this example, the button is named Call PDF Butler.
6. Configure the button using the following settings:
- Display Type: Detail Page Button
- Behavior: Display in new window
- Content Source: URL
Step 02: Configure the PDF Butler URL #
7. In the URL configuration, enter the PDF Butler document generation URL. The URL calls PDF Butler and uses parameters to identify the document configuration and Salesforce record.
8. Add the required parameters to the URL:
- docConfigId: The ID of the PDF Butler Doc Config used to generate the document.
- objectId: The ID of the Salesforce record from which the document should be generated.
9. For docConfigId, copy the ID of the Doc Config you want to use and include it as the parameter value.
10. For objectId, use the Salesforce merge field that references the current record’s ID.
For example, a button on an Opportunity record can use {!Opportunity.Id} to pass the appropriate record ID to PDF Butler.
11. If you want the generated PDF to open directly in the browser, include the openRaw parameter in the URL.
12. Add any additional URL parameters required for your document generation workflow.
Available options include:
- targetType: Specify the output format, such as PDF or DOCX. The default is PDF.
- alternativeName: Specify an alternative filename for the generated document.
- locale: Set the locale used for document generation.
- deliveryOverwrite: Override the delivery type configured in the Doc Config.
- download: Use the value 1 to download the generated PDF automatically.
13. Click Save to save the custom button.
Step 03: Add the Button to the Salesforce Record Page #
14. Return to the selected Salesforce object in Object Manager.
15. Open Page Layouts and select the layout where you want to display the button.
16. Add the custom button to the appropriate button or action section of the page layout, depending on your Salesforce interface.
17. Save the updated page layout.
Step 04: Generate a Document Using the Button #
18. Open a Salesforce record where the custom PDF Butler button is available.
19. Click Call PDF Butler to start document generation.
20. PDF Butler uses the configured Doc Config and current record ID to generate the document.
21. If the button uses openRaw, the generated PDF opens in a new browser window.
22. Review the document to confirm that the correct information has been populated from Salesforce.