Template Common Settings

Create the template files as follows.

 

Template file

  • Create a template file in the same file format as the output file format, either Excel (.xlsx, .xlsm), Word (.docx, .docm), or PowerPoint (.pptx, pptm). For PDF output, create a Word (.docx) format.
  • Template file size should not exceed 1 MB. If the file contains a large amount of text or images, even within 1 MB, the file will fail to output.
  • Template files should be created in the Microsoft Office desktop version.
  • Images such as company logos can be included in the template file. However, depending on the file size of the image, output may take a long time or result in an output error. In the case of PDF output, the layout may be corrupted. Please check the actual output in a test environment.

 

 

Merge Field

Merge Fields Format

  • Enter the merge fields with the format {!Object Name.Field Name} in the template file.The format of the merge field is the same as the Salesforce classic email template.
  • The fields of the master object and related child objects can be used as the merge fields.
  • If the user outputting the file does not have reference permission to the merge field, the merge field will be output blank.
  • Formulas cannot be used such as {!If(xxxxx)} for the merge field.

 

Example of merge fields

Primary Object

{!Opportunity.Name} *Standard object.Standard field

{!Opportunity.OrderDate__c} *Standard object.Custom field

{!Bill__c.Name} *Custom object.Standard field

{!Bill__c.IssueDate__c} *Custom object.Custom field

 

Child object

{!OpportunityLineItems.Name} *Standard field.Standard field

{!OpportunityLineItems.OrderDate__c} *Standard field.Custom field

{!BillDetails__r.Name} *Custom field.Standard field

{!BillDetails__r.IssueDate__c} *Custom field.Custom field

 

Reference Field

  • Reference fields can be output either Id or Name field. To output Name field, check the "Output Name Not Id For Reference Field" checkbox in the OFC_Template record.
  • Cross-Object Formulas (e.g. {!Opportunity.Account.BillingCity}) are available in ver 2.0 and later.

 

Rich Text Area Field

Rich text area field values are output with Html tagged values stored in Salesforce. The output cannot be formatted as it displays on the record screen. The values stored in Salesforce can be viewed in the Developer Console or Dataloader.

 

Decimal point Considerations

Some standard fields, such as Opportunity Amount and Quote Amount, may have decimal points stored in Salesforce even if the decimal point is not displayed on the record screen. For example, if Opportunity Quantity contains a decimal point, Amount is stored with a decimal point even though the data type of Amount is "Currency (16, 0)". The values stored in Salesforce should be checked in the Developer Console or Dataloader.

 

For output options, refer to Output Options.

 

 

Child Object

Merge Fields Format

  • For the merge fields of the child object, set {!ChildObject Relationship Name.Filed Name} format in the template file. If the reference field is a custom field, append "__r" at the end of the child relationship name
    g., The reference field is a standard field: {!OpportunityLineItems.Product2}
    e.g., The reference field is a custom field: {!OpportunityCases__r.CaseNumber}
  • For the merge fields of the child object of the package object, set {!Namespace Prefix__Child Relationship Name__r.Field Name} format in the template file.
    g., If the package namespace prefix is "BillingMaster
    and the child relationship name is "BM_BillDetail_Bills,
    {!BillingMaster__BM_BillDetail_Bills__r.Name}
  • For the merge fields of the child object, enter only one line. The number of lines is output according to the number of child records.
  • To output sequential numbers of child records, enter {!number()}. Sequential numbers starting from 1 is output.

 

How to check the child relationship name

  1. Go to the Object Manager and check the list of fields of the corresponding child object.
  2. Click on the field name of the primary objects reference fields in the child objects field list.
  3. The content displayed in the child relationship name in the fields setting information is the child relationship name. At this time, if the parent objects reference field is a custom field, the child relationship name will be the one with "__r" appended to the end of the displayed child relationship name. For package objects, prefix with namespace prefix + "__".

 

 

Limitations

  • Not all layouts and output patterns are supported. Complex layouts are not supported.
  • Template files created with non-Microsoft Office desktop versions (e.g., online versions, other applications, etc.) are not supported.
  • Not all features of Office files are available. Some features will be ignored.

 

 

Reference

How to find the merge field and childrelation names

 

 

Troubleshooting

The value of the merge field is output as it is in the output file.

Check the following to ensure that the format of the merge field is correct

Check if the format of the merge field is {!Object API Name.Item API Name}.

Check if the object name and field name are correct.

Check if "!" is not missing.

Check if there are no unnecessary spaces.

*Not all layouts and output patterns are supported. Please note that we may not be able to support your output pattern.

 

Number fields are not output with 3-digit comma delimiters.

In Excel, set the format from the cell formatting.

In Word, PowerPoint, and PDF, check on "Adjust Format (commas/decimal places)" in the OFC_Template record to output numeric fields in 3-digit delimiter comma notation.

Formatting of Currency and Number Fields (Ver.1)

 

The currency symbol for the currency field is not output.

In Excel, from the cell formatting, set the template file so that the currency is displayed.

In Word and PowerPoint, add the currency to the beginning of the merge fields in the template file.

e.g. ${!Opportunity.Amount}

 

Rich text area field values are output with Html tags.

Rich text area field values are output with Html tagged values stored in Salesforce. The output cannot be formatted as it displays on the record screen. The values stored in Salesforce can be viewed in the Developer Console or Dataloader.

 

When Outputting a file, the error message ″Failed to read the template file. The file format may be incorrect or the file may be corrupt. Please upload a valid template file from the OFC_Template Record screen. is shown.

OFC may not support the output pattern. Try the following.

  • If the file has a complex layout, simplify the layout.
  • In Excel, delete unused rows and columns. Excel normally saves rows with values and formatting, but for some reason an empty row may be recognized as a used cell and a large number of unnecessary rows are saved.
  • In Excel, check for hidden and unnecessary sheets, and delete any unnecessary sheets.
  • If Office functions (e.g., graphs, pivot tables, etc.) are used, remove Office functions. OFC may not support them.
  • If images are included in the template file, reduce the file size of the images by lowering the image quality.

 

When outputting with the custom button, the file cannot be downloaded from the same record screen for the second and subsequent times. The screen must be refreshed to output again.

Check your browser download settings. As an example, the settings for Chrome are as follows.

  • From Chrome settings, go to Privacy and security > Site settings > View permissions and data stored on across sites. Click on "salesforce.com". Click on the target domain URL and check "Automatic downloads". If "Automatic downloads" is "Block", change it to "Ask (default)" or "Allow".
  • From Chrome settings, go to Privacy and security > Site settings > Additional permissions > Automatic downloads. Check the URL list under "Not allowed to automatically download multiple files". If there is a Salesforce URL here, click the ":" on the far right and click "Remove".

How to deal with the problem of not being able to download files or multiple files from a custom button