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 Seach apps and items box. Click Office File Creator in the Apps.

*For Ver. 1, select OFC_Template.

*For Salesforce Classic, select Office File Creator for Classic from the list of applications in the upper right corner of the screen.


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


Enter each field and click Save.




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.

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}

Template File Type: Select the template file type.



PDF Settings

PDFIncludesMultiByteCharacter__c: Select "Include" when languages that don't use the Latin character set, such as Japanese using multibyte characters.

PDFDefaultFont__c: 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", all characters are output Arial Unicode MS font.



(Optional) Reference Field

IsOutputNameNotIdForReferenceField__c: The Id field value is normally output when the field type is a reference field. Check this field if you want to output the Name field value instead of the Id field value.



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.



When changing the template file, please upload it again. After uploading the template file, do not update the registered Attachment record from Dataloader or Apex, etc. If the Attachment record is updated, it cannot be output with an error.



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 Output Test and Verify Merge Fields button on the Record Details screen to display the Test Output and Merge Fields Validation 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 file.
  • 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 Dataloader.



4.5.  Reference

When creating a record, also refer to the following articles.

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