To create a “Generate Documents” button for a record’s details page layout go to Setup -> Object Manager -> Selected Object -> Buttons, Links and Actions -> New Button or Link.
Next, populate the fields with the following values:
FIELD NAME | VALUE |
LABEL | Any name, e.g. Generate Documents. This will be the name of the button displayed in the app. |
NAME | Any name used by the API and managed packages, e.g. “Generate_Documents”. |
DESCRIPTION | Provide your description of the button. |
DISPLAY TYPE | Select “Detail Page Button”. |
BEHAVIOUR | Select “Display in existing window with sidebar”. |
CONTENT SOURCE | Select “Visualforce Page”. |
CONTENT | Select Visualforce page created specifically for that object. |
Next, add the button to the object’s page layout. While still on the Object Manager page of the selected object, go to “Page Layout” and open the selected page layout. Under the “Mobile & Lightning Actions” section click the “Generate Documents” tile and drag it down onto the layout under the “Salesforce Mobile and Lightning Experience Actions” section. Save Changes.