Generate an Excel file in Salesforce using Office File Creator - (3) Create custom buttons

Following the previous step of creating a template record, create custom buttons.

About the previous step of creating a template file, please refer to Generate an Excel file in Salesforce using Office File Creator – (2) Create a template record.

 

Create custom buttons

Create two custom buttons, one for file output and one for file save in salesforce.

Click the settings icon in the upper right corner of the screen and click "Setup".

 

From the Object Manager tab, click "Opportunity".

 

First, create a custom button for file output.

Click "Buttons, Links, and Actions" in the left sidebar, then click the "New Button or Link" button.

 

Label

Enter "Output Excel".

Name

Enter "Output_Excel".

Display Type

Select "Detail Page Button".

Behavior

Select "Display in existing window without sidebar".

Content Source

Select "URL".

URL

Copy and paste the value of the ″Custom Button URL(Export to File)″ field in the OFC_Template record.

 

Click the "Save" button, then click "OK" when the message "The new custom button will be ~" appears.

 

Next, create a custom button for file saving.

Click "New Button or Link" and save the following custom button.

 

Label

Enter "Save as Excel".

Name

Enter "Save_as_Excel".

Display Type

Select "Detail Page Button".

Behavior

Select "Display in existing window without sidebar".

Content Source

Select "URL".

URL

Copy and paste the value of the ″Custom Button URL(Save as File)″ field in the OFC_Template record.

 

Click the "Save" button, then click "OK" when the message "The new custom button will be ~" appears.

 

 

Put the custom button on the page layout

Click "Page Layouts" in the left sidebar, then click the name of the page layout to place the custom buttons.

 

If you do not see the button under "Salesforce Mobile and Lightning Experience Actions," click "override predefined actions" or the settings icon on the right.

 

 

Click "Mobile & Lightning Actions" and drag and drop the two custom buttons you created into the "Salesforce Mobile and Lightning Experience Actions" button display field. Click the "Save" button.

 

The custom buttons "Output Excel" and "Save as Excel" appear on the record detail page of Opportunity.

By clicking the Output Excel " button, output the file to your local PC. If your browser is Chrome, the file is output to the download folder by default.

 

By clicking the "Save as Excel" button, the file is saved related to the record in Salesforce.

 

Sample File

 

The template file created in this article can be downloaded below.

Invoice Excel Template.xlsx

 

 

タイトルとURLをコピーしました