Quick Guide

This procedure is a simplified procedure for Office File Creator. For detailed procedures, please refer to Instruction manual.

 

1. Install

From the Install page, go to the Appexchange page and click "Get It Now". Proceed through the screens in order, and when the installation screen appears, select "Install for Admins Only" and click "Install". After the installation is complete, log in to the Salesforce organization in which you installed the app.

  • The expiration date of the paid version can be found at Setup>Apps>Packages>Installed Packaging>Office File Creator. The paid version of the Sandbox environment is available indefinitely.

 

 

2. Grant Permissions

Grant permissions to each profile.

  • Admin User is the user who manages the OFC_Template record, template files and the OFC_Log record.
  • General User is the user who outputs files.

     

    *This procedure is for Office File Creator Ver.2. If you are using Ver.1, refer to Grant Permissions (Office File Creator Ver.1).

     

    Permissions for Office File Creator Ver.2

    Settings

    Object

    Admin User

    General User

    Custom App Settings

    -

    Office File Creator

    Office File Creator Classic

    -

    Custom Tab Settings

    OFC_Template

    Default On

    Tab Hidden

    OFC_Child Object Option

    Default On

    Tab Hidden

    OFC_Log

    Default On

    Tab Hidden

    Custom Object Permissions

    OFC_Template

    Read/Create/Edit/Delete

    Read

    OFC_Child Object Option

    Read/Create/Edit/Delete

    Read

    OFC_Log

    Read

    -

    Field-Level Security

    OFC_Template

    Read/Edit Access to all fields.

    -

    OFC_Child Object Option

    Read/Edit Access to all fields.

    -

    OFC_Log

    Read Access to all fields.

     

    Apex Class

    -

    Grant access to Apex classes with the names beginning with "ofc2.".

    Visualforce Page

    -

    Grant access to Visualforce Pages with the names beginning with "ofc2.".

     

     

    3. Create Template File

    Create a template file for the form source.

    Common

    Template file format

    • 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.
    • Not all layouts and output patterns are supported. Complex layouts are not supported.
    • 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.
    • Not all features of Office files are available. Some features will be ignored.
    • Template files should be created in the Microsoft Office desktop version. Template files created by the online version or other applications are not supported.

     

    Merge Field

    • 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.
    • Formulas cannot be used such as {!If(xxxxx)} for the merge field.

    Example of merge fields

    Standard field of standard object: {!Opportunity.Name}

    Custom field of custom object: {!Bill__c.IssueDate__c}

     

    For output options, refer to Output Options.

     

    Child Object

    • 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, 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 + "__".

       

      Sample

      Primary Object

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

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

       

      Child object

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

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

       

      Sample Template

       

       

      Reference

      How to find the merge field and childrelation names

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

      Setting Formulas in Excel Template Files with Office File Creator

      Generate a Word document in Salesforce using Office File Creator

      Generate a PowerPoint file in Salesforce using Office File Creator

      Generate a PDF file in Salesforce using Office File Creator

       

       

      4. Create Template Record

      Select "Office File Creator" from the application launcher, and from the OFC_Template tab, click the "New" button in the list view.

       

      Enter each field and click Save.

       

      Fields (only required fields)

      Field name Contents
      Name Enter the template name.
      Template Api Name Template Api Name can only contain alphanumeric characters and underscores, must begin with a letter.
      e.g. Opportunity_Quote_Excel
      Object Api Name Enter the master object name used for the merge field in the template file.
      e.g. Opportunity
      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. Quote_{!Opportunity.Name}

       

      Please refer to Output Options for more information on optional features.

       

      Upload the template file from the Upload Template File component on the OFC_Template record page.

       

      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.

       

      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.

       

      Reference

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

       

       

      5. Create Custom Button

      Create custom buttons to output files on the record detail page.

      *If you want to output and save a file from the button of Lightning Component, please refer to Create buttons on Lightning Record Page.

       

      From the Object Manager in Settings, click on "Buttons, Links, and Actions" of the target object, then click on the "New Button or Link" button.

       

      Enter each field and click Save.

       

      Custom Button Contents

      Field Name

      Contents

      Label

      Enter the label name of the custom button to be placed on the record detail page.

      e.g. Output Invoice

      Name

      Enter the API name for custom button.

      e.g. OutputInvoice

      Display Type

      Detail Page Button

      Behavior

      Display in existing window with sidebar

      Content Source

      URL

      URL

      Copy and paste the value of the "Custom Button URL(XXX)" field in the OFC_Template record.

      • To output (download) a file, copy the value of the "Custom Button URL (Export to File)" field.
      • To attach to a record in Salesforce and save to File, copy the value of the "Custom Button URL (Save as File)" field.
      • To attach to a record in Salesforce and save to Attachment, copy the value of the "Custom Button URL (Save as Attachment)" field.

      e.g. /apex/ofc2__OFCOut?ns=ofc2&template=OpportunityInvoice&id={!Opportunity.id}

       

      Copy the URL value from the OFC_Template record.

       

      Open the page layout edit screen from "Page Layout" of the target object, and place the custom button you created by drag & drop.

       

      From the record detail page, click the Custom button to output (or save) the file.

       

       

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