How to Add a Document Generation Button in Salesforce with Dochly
Where the button lives on a record page
In Salesforce Lightning Experience, the Generate Document button sits in the record's Highlights Panel actions — the row of action buttons at the top of every record page. This is the same area where standard actions like Edit, Delete, Clone, and Send Email appear.
Clicking Generate Document opens the Dochly generation modal — the user selects a template, confirms settings, and generates the document without leaving the record.
Which objects to add the button to
Add the Generate Document button to every object that has an Active Dochly template. The button only shows Active templates for the current record's object — so adding it to the Opportunity layout only shows Opportunity templates, and won't interfere with other objects.
| Object | Common templates generated | Navigation path |
|---|---|---|
| Opportunity | Proposals, quotes, invoices, order confirmations | Object Manager → Opportunity → Page Layouts |
| Account | Account summaries, welcome letters, statements | Object Manager → Account → Page Layouts |
| Contact | NDAs, onboarding packets, HR letters | Object Manager → Contact → Page Layouts |
| Contract | Renewals, amendments, addenda | Object Manager → Contract → Page Layouts |
| Case | Case summaries, resolution letters | Object Manager → Case → Page Layouts |
| Custom object | Any custom document type | Object Manager → [Object API Name] → Page Layouts |
Step-by-step: adding the Generate Document button
Open the page layout in Salesforce Setup
Navigate to the page layout for the object you want to add the button to:
If your org has multiple page layouts for the same object (e.g. different layouts for Sales Rep vs Manager profiles), you'll need to add the button to each layout separately. See Multiple page layouts below.
Find the Dochly Generate Document button in the palette
In the Lightning page layout editor, look at the palette on the left side. Click Mobile & Lightning Actions in the palette sections — this is where quick action buttons are listed.
Scroll down in the palette to find Generate Document. Installed package actions appear near the bottom of the actions list. You can also use the search box in the palette to type "Generate" and filter the list.
If Generate Document doesn't appear in the palette, confirm Dochly is correctly installed (Setup → Installed Packages → Dochly = Installed) and that the Dochly connection status shows green (Dochly → Settings → Connection Status).
Drag the button into the Salesforce Mobile and Lightning Experience Actions section
In the layout editor, scroll down to the section called Salesforce Mobile and Lightning Experience Actions. This is the section that controls which buttons appear in the Highlights Panel actions row on the record page.
Drag Generate Document from the palette into this section. Position it near other frequently-used actions — users typically expect generation buttons near Edit and Send Email.
Do not add the button to the "Buttons" section at the top of the page layout — that controls a different, older button area that doesn't appear in Lightning Experience. Always add it to the Salesforce Mobile and Lightning Experience Actions section.
Save the page layout and verify
Click Save at the top of the page layout editor. The layout saves immediately and the button becomes available on record pages without requiring a deploy or refresh.
To verify: open a record of this object type (e.g. an Opportunity) and look for the Generate Document button in the actions row. If it doesn't appear immediately, hard-refresh the page (Ctrl+Shift+R / Cmd+Shift+R).
Multiple page layouts
Many Salesforce orgs have multiple page layouts for the same object — different layouts for different profiles (Sales Rep layout vs Manager layout vs Partner layout). The Generate Document button must be added to each layout separately.
Setup → Object Manager → [Object] → Page Layouts. All layouts for that object are listed. Check each layout name and identify which profiles are assigned to which layout via the Page Layout Assignment button at the top of the layouts list.
Click Page Layout Assignment on the layouts list page to see a table of all profiles and which layout each profile uses. Add the Generate Document button to every layout that should have it, based on which user profiles should be able to generate documents.
A common approach: add the Generate Document button to all layouts, then control who can use it through the Dochly permission set. Users without the Dochly User permission set see the button but get an access error — so it's better to only add the button to layouts used by profiles that have the permission set assigned.
Mobile and Salesforce app
Adding the button to the Salesforce Mobile and Lightning Experience Actions section of the page layout automatically makes it available on the Salesforce mobile app — no separate configuration needed. Users on iPhone, iPad, or Android can tap Generate Document directly from any record.
On mobile, the Generate Document button appears in the Actions menu (the "…" dots menu at the bottom of the record). Tapping it opens the Dochly generation modal — optimized for touch with large tap targets and a scrollable template list.
The order of buttons in the Salesforce Mobile and Lightning Experience Actions section determines their order on mobile. Move Generate Document near the top of the section to make it appear earlier in the mobile Actions menu.
Adding the button to custom object layouts
The process is identical for custom objects — the only difference is navigating to the correct custom object in Object Manager. Custom objects appear in Object Manager alphabetically by their display label, not their API name.
Ensure the custom object is enabled in Dochly Settings
Before adding the button, confirm the custom object is listed in Dochly → Settings → Object Access. If it's not there, add it and create an Active template for it first. The Generate Document button on a custom object page will show no templates until there is at least one Active template with that object as its primary object.
Find the custom object in Setup → Object Manager
Go to Setup → Object Manager and find your custom object by its display label. Click it to open the object settings, then follow the same steps as standard objects: Page Layouts → [Layout Name] → drag Generate Document into the Salesforce Mobile and Lightning Experience Actions section → Save.
Controlling button visibility
The Generate Document button is visible to any user whose profile uses a page layout with the button added. To control who sees and can use the button, use a combination of page layout assignments and Dochly permission sets.
The button only appears on record pages when the user's profile is assigned to a layout that includes the Generate Document action. Remove the button from layouts used by profiles that should never see it — e.g. read-only partner portal users.
Even if the button is visible, users without the Dochly User permission set cannot successfully generate documents. Assigning the layout + the permission set together gives a user full Generate Document capability.
| User scenario | Button on layout? | Dochly permission set? |
|---|---|---|
| Sales rep — full generate access | ✓ Yes | ✓ Dochly User assigned |
| Manager — view documents only | ✓ Yes (optional) | ✓ Dochly Read Only assigned |
| Partner portal user — no access | ✗ Remove from layout | ✗ No Dochly permission set |
| Admin — full template + generate access | ✓ Yes | ✓ Dochly Admin assigned |
Verification checklist after adding the button
After adding the button to a page layout, run through this quick check to confirm it's working correctly:
- Button appears on the record page — open a record of the correct object type and confirm Generate Document appears in the actions row. Hard-refresh if it doesn't appear immediately.
- Button works for a standard user — log in as a non-admin user with the Dochly User permission set and confirm they can see and click the button successfully.
- Template picker shows the correct templates — clicking the button should show all Active templates for this object. If no templates appear, confirm there is at least one Active template with this object as primary.
- Generation completes and file attaches to record — generate a test document and confirm the file appears in the record's Files related list immediately after generation.
- Button appears on mobile — open the record on the Salesforce mobile app, tap the "…" Actions menu, and confirm Generate Document appears in the list.
Frequently asked questions
The Generate Document button is now on your Salesforce record pages — giving every user one-click document generation without leaving the record. Next in this series: How to trigger document generation from a Salesforce Flow with Dochly — automate generation without any user action.
Rated 5 stars · Native Salesforce app · Free to install