Creating a button to Auto-populate an Invoice

To auto-populate your invoice, enter Setup in your Salesforce Instance and please follow the steps below:

Step 1 – Under Build navigate to Create -> Objects and select the Invoice object

Step 2 – Scroll down to Buttons, Links, and Actions and select New Button or Link.

Step 3 – Type in the label for the button, select List Button and uncheck ‘Display Checkboxes (for Multi-Record Selection)

Step 4 – Insert the following line with your Salesforce instance name from the New Invoice page. This can be found by navigating to the Invoices related list on the Opportunity and selecting New Invoice.

Your Salesforce instance name can be found in the URL used to view your page as highlighted below:

Step 5 – Under Build navigate to Create and select Objects, taking care to open Objects by holding down CTRL and selecting a New Tab.

Step 6 – Select the Invoice object from the available list

Step 7 – Decide on the fields you would like to auto-populate. In the following example ‘Date’ has been chosen. Make sure to select API name as indicated below:

Step 8 – Copy the selected fields into your formula field on the other tab opened in Step 3. For this example, Date has been set to populate with ‘Today’s Date’.

Step 9 – For each additional field, start on a new line and begin with &. In the example below Contact has been selected.

Step 10 – Assign a dynamic value to the field by selecting Insert Merge Field and selecting the appropriate the value. In this case Contact ID.

Step 11 – To include more fields to auto-populate, follow Steps 7 through 10 as necessary. An example is illustrated below:

Step 12 – Once all the required fields have been added, select Save

Step 13 – To add the button to the Page Layout, under Build navigate to Customize -> Opportunities and select Page Layouts.

Step 14 – Scroll down to Related Lists and select the Wrench icon.

Step 15 – Next to Button select the + icon.

Step 16 – You will see your button listed under Available Buttons. Select it and click to move the button to the right side under Selected Buttons. Select OK.

Step 17 – Save the Page Layout by selecting Save at the top of the page.

Step 18 – To check that your button is available and auto populates the relevant opportunity fields into a new invoice, navigate to an opportunity, scroll down to the Invoices related list and select your button.