Skip to content

Setting up Custom Button

Click setting gear icon and click Setup > Object Manager tab

Select an object. e.g. Account

Click Buttons, Links, and Actions

This will appear if the image fails to load

Click New Button or Link button.

This will appear if the image fails to load

Enter Button Details.

Note : Display Type should be Detail Page Button

Behavior is Display in New Window

Set Content Source to URL

Set format by entering syntax below. Align id with what object is chosen.

{!URLFOR(“/apex/rooms__GenerateDocument”, null, [id=Account.Id])}

Note: the file name can optionally be passed as a parameter in the URL. /apex/rooms__GenerateDocument?filename=defaultFileName.pdf

This will appear if the image fails to load

Click Save button.

This will appear if the image fails to load

Modifying Page Layout

Go back to Object Manager >> Account Click Page Layout

This will appear if the image fails to load

Choose a page layout. e.g. Account Layout

This will appear if the image fails to load

Drag and Drop Generate Document to Custom Button area, and then save changes.

This will appear if the image fails to load

Viewing Custom button

Go to Accounts and select any account.

Click on drop down menu to view the Generate Document button

This will appear if the image fails to load

Document Generation

Go to an account record.

Click Generate Document button

Choose a document template e.g. Master Service Agreement

Select output format. PDF or Word DOCX

Enter Attachment File Name.

Click Generate Document and Attach to Record button

This will appear if the image fails to load

System will then attach the document to Account Notes and Attachments section

This will appear if the image fails to load