> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fusioncore.us/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuring Financial Documents

> Change which fields print on your Financial Documents and which Visualforce template renders each document type.

## Overview

Financial Documents are the printable PDFs your staff open from an Order or a Financial Event, such as a Quote, Invoice, Receipt, Refund, Installment schedule, or order Summary.

fusionCore ships these documents pre-configured, so they work out of the box. You only need this page when you want to change them. You can configure two things without writing any code:

* **Which fields appear** on a document, by editing a field set.
* **Which template renders** a document, by pointing it at a different Visualforce page.

Both are controlled by **Custom Metadata** records. The Financial Documents package stores its configuration in a Custom Metadata Type named `FCORE_BASE__Constant__mdt`, which you reach under **Setup → Custom Metadata Types → Constant → Manage Records**. Each row, called a Constant, holds one setting in its **Text Value** field (`FCORE_BASE__Text_Value__c`).

A few terms used below:

* An **Order** is the record that represents a sale. Quote and Invoice documents, and the Summary document, are generated from it.
* A **Financial Event** (`FCORE_PAY__Financial_Event__c`) is a fusionCore record that represents a single payment, refund, or installment. Receipt, Refund, and Installment documents are generated from it.
* A **field set** prints each of its fields, in order, as a label and value pair on the document.

## Configure Which Fields Print on a Document

Each document has two field sets: one for the **customer details** block and one for the **document details** block. You change the printed fields by choosing a field set and naming it in the matching Constant.

### Prerequisites

* You can edit Custom Metadata records and field sets (a System Administrator profile, or a permission set that grants both).
* You know which object backs the document you want to change: **Order** for Quote, Invoice, and Summary; **Financial Event** for Receipt, Refund, and Installment.

### Steps

<Steps>
  <Step title="Choose or build the field set">
    In **Setup → Object Manager**, open **Order** or **Financial Event**, then open **Field Sets**. Edit an existing field set, or create a new one, and add, remove, or reorder the fields you want to print. The document renders each member in the order it appears in the set.
  </Step>

  <Step title="Open the matching Constant">
    Go to **Setup → Custom Metadata Types → Constant → Manage Records**, then open the Constant for the document and block you are changing. Use the table below to find the right one.

    | Constant                                   | Object          | Controls                                     |
    | ------------------------------------------ | --------------- | -------------------------------------------- |
    | `FS_Quote_Doc_Customer_Details_FieldSet`   | Order           | Customer details on the Quote document       |
    | `FS_Quote_Doc_Document_Details_FieldSet`   | Order           | Order details on the Quote document          |
    | `FS_Invoice_Doc_Customer_Details_FieldSet` | Order           | Customer details on the Invoice document     |
    | `FS_Invoice_Doc_Document_Details_FieldSet` | Order           | Order details on the Invoice document        |
    | `FS_Summary_Doc_Customer_Details_FieldSet` | Order           | Customer details on the Summary document     |
    | `FS_Summary_Doc_Document_Details_FieldSet` | Order           | Order details on the Summary document        |
    | `FS_Receipt_Doc_Customer_Details_FieldSet` | Financial Event | Customer details on the Receipt document     |
    | `FS_Receipt_Doc_Document_Details_FieldSet` | Financial Event | Payment details on the Receipt document      |
    | `FS_Refund_Doc_Customer_Details_FieldSet`  | Financial Event | Customer details on the Refund document      |
    | `FS_Refund_Doc_Document_Details_FieldSet`  | Financial Event | Payment details on the Refund document       |
    | `FS_Installment_Doc_Customer_Det_FieldSet` | Financial Event | Customer details on the Installment document |
    | `FS_Installment_Doc_Document_Det_FieldSet` | Financial Event | Payment details on the Installment document  |
  </Step>

  <Step title="Enter the field set API name">
    Set the Constant's **Text Value** (`FCORE_BASE__Text_Value__c`) to the API name of your field set, then click **Save**.

    <Frame caption="image-20251210-222021.png">
      <img src="https://mintcdn.com/fusionspan/4u-JGPkRA8QDMGYi/images/end-user-guides/4857430155/image-20251210-222021.png?fit=max&auto=format&n=4u-JGPkRA8QDMGYi&q=85&s=e6b7dcf5c59175cefb194c0d11388f3b" alt="A Constant Custom Metadata record with a field set API name in the Text Value field" width="1648" height="522" data-path="images/end-user-guides/4857430155/image-20251210-222021.png" />
    </Frame>
  </Step>
</Steps>

<Note>
  Every field you add to a field set must be readable by the user opening the document. If the running user cannot read a field, it prints blank. Date fields are formatted as date-only; if you place a Date/Time field in a set, it will not be trimmed to a date.
</Note>

## Configure Which Visualforce Template Renders a Document

Each document type renders through a Visualforce page. To use your own branded template, deploy a Visualforce page and name it in the matching Constant. The action builds the URL as `/apex/<Text Value>?id=<record UUID>`, so the value must be the API name of a Visualforce page that is deployed in your org.

### Prerequisites

* Your replacement Visualforce page is already deployed in the org.
* You can edit Custom Metadata records.

### Steps

<Steps>
  <Step title="Open the matching Constant">
    Go to **Setup → Custom Metadata Types → Constant → Manage Records**, then open the Constant for the document you are changing.

    | Constant                              | Default Visualforce page | Document                      |
    | ------------------------------------- | ------------------------ | ----------------------------- |
    | `FS_Invoice_Document_VF_Template`     | `InvoiceDocument`        | Invoice (Order)               |
    | `FS_Quote_Document_VF_Template`       | `QuoteDocument`          | Quote (Order)                 |
    | `FS_Summary_Document_VF_Template`     | `SummaryDocument`        | Summary (Order)               |
    | `FS_Receipt_Document_VF_Template`     | `ReceiptDocument`        | Receipt (Financial Event)     |
    | `FS_Refund_Document_VF_Template`      | `RefundDocument`         | Refund (Financial Event)      |
    | `FS_Installment_Document_VF_Template` | `InstallmentDocument`    | Installment (Financial Event) |
  </Step>

  <Step title="Enter the Visualforce page name">
    Set the Constant's **Text Value** (`FCORE_BASE__Text_Value__c`) to the API name of your Visualforce page, then click **Save**.

    <Frame caption="image-20251210-222522.png">
      <img src="https://mintcdn.com/fusionspan/4u-JGPkRA8QDMGYi/images/end-user-guides/4857430155/image-20251210-222522.png?fit=max&auto=format&n=4u-JGPkRA8QDMGYi&q=85&s=0a1ed08553a8277dd1d403bae582c095" alt="A Constant Custom Metadata record with a Visualforce page name in the Text Value field" width="1647" height="491" data-path="images/end-user-guides/4857430155/image-20251210-222522.png" />
    </Frame>
  </Step>
</Steps>

<Warning>
  Do not leave a template Constant blank. If you clear the **Text Value** on a Quote, Invoice, Receipt, Refund, or Installment template Constant, the corresponding **View Document** button stops working with a "Document Template is not defined" error. The Summary document does not give that friendly message: if `FS_Summary_Document_VF_Template` is missing or blank, **View Summary Document** fails with a raw error instead.
</Warning>

## Limitations and Common Pitfalls

* **A document can refuse to open.** Before the button can render a document, the record must pass a few checks. An Order needs a synced Order UUID, at least one product line, and an Order Type of **Quote** or **Invoice**. A Financial Event needs an event UUID, and Payment or Refund events must have a status of **Succeeded** (only Installment events skip the status check). Payment, Refund, and Installment are the only supported Financial Event types. If a record fails one of these checks, the button shows an explanatory message instead of opening the PDF.
* **Two permission sets are required.** Staff need both `FS_Financial_Documents_View_Document_Actions` (which grants the buttons) and `FS_Financial_Documents_VF_Pages` (which grants the Visualforce pages the buttons open). With only the first, the button runs but the PDF page throws an access error.
* **Fields can print blank.** A field set member that the opening user cannot read renders empty. Confirm field-level security for the running user and for the portal context if customers view these documents.
* **The document opens in a new browser tab.** A pop-up blocker can suppress it.
* **Date/Time fields are not trimmed.** Field-set members are date-formatted only when they are Date fields, not Date/Time fields.

<Warning>
  **Currency symbols.** Documents render currency symbols from the ISO currency code, and fall back to printing the ISO code itself when no symbol is available. Because these PDFs are produced by Visualforce, some symbols, such as the Indian Rupee, are not rendered and the document shows the ISO code instead.
</Warning>
