4. Create Template Record

Create OFC_Template Object record. OFC_Template record stores the settings such as the master object used for merging fields, the sorting of child object records, and the template file.

4.1. Create Template Record

Click the icon of the App Launcher and enter "of" in the Search apps and items box. Click Office File Creator in the Apps.

*For Ver. 1, select OFC_Template.

 

The OFC_Template list view will be shown. Click New on the top right of the screen.

 

Enter each field and click Save.

 

Information

Name: Enter the template name.

Category: Enter the category to manage the template record, such as the division name.

e.g. Sales, Accounting

Template API Name: Enter any unique Template API name. Enter only alphanumeric characters and underscores beginning with a letter.

e.g. OpportunityInvoice

Object API Name: Enter the master object API name used for the merge field in the template file.

e.g. Opportunity

 

File Type

Output File Type: Select the file type to output files.

Output File Name: Enter the output file name. The master object fields can be used as the merge fields.

e.g. Invoice_{!Opportunity.Name}

 

PDF Settings

PDF Includes MultiByte Character: Select "Include" when using multibyte characters, such as Japanese.

PDF Default Font: It is the default font when the font used in the Word template file is not available in this application. If "PDF Includes MultiByte Character" is "Include", select "Arial Unicode MS".

 

4.2. Upload Template File

Upload the Excel, Word, or PowerPoint template file from the Upload Template File component on the OFC_Template record page.

*In Salesforce Classic, click the Upload Template File button on the record detail screen to display the template file upload screen.

 

An upload completion message will be displayed.

 

Memo

The uploaded template file is attached to the OFC_Template record and stored in the Note and Attachment (Attachment) object. The uploaded template file is changed by the application for output, so keep the original template file separately.

 

4.3. Export Test and Verify Merge Fields

Enter the record Id, such as Opportunity record, in the text box on the Export Test and Verify Merge Fields component, and click Export to File.

*In Salesforce Classic, click the Export Test and Verify Merge Fields button on the Record Details screen to display the Export Test and Verify Merge Fields screen.

 

Open the output file and check that the contents of the file are correct, such as whether the values of the merge fields have been output correctly and whether the layout is correct.

 

4.4. Note

  • The uploaded template file is attached to the OFC_Template record and stored in the Note and Attachment (Attachment) object. The uploaded template file is changed by the application for output, so keep the original template file separately.
  • The free version allows the creation of only one template record.
  • The free version allows template files to be uploaded only from the OFC_Template record screen. Template files cannot be uploaded from other than the OFC_Template record screen, such as Data Loader.
  • When changing the template file, please upload it again. After uploading the template file, do not update the registered Attachment record from Data Loader or Apex, etc. If the Attachment record is updated, it cannot be output with an error.

 

4.5. Reference

Generate an Excel file in Salesforce using Office File Creator – (2) Create a template record