Skip to main content

Account Derivation

Account derivation is the process of resolving which GL code combination (account) each subledger journal line should post to. Rather than hard-coding accounts on every transaction, FSL uses a priority-based rule engine that searches a chain of sources until it finds a match.

Line types​

Every journal line is categorised by a line type that determines what kind of entry it represents. The line type drives which derivation rules apply. See the Data Model for the full list of seeded line types.

Derivation rules​

A derivation rule belongs to an accounting method and a line type. It specifies:

  • Source — where to look for the account (e.g. customer site, item, ledger default)
  • Priority — the order in which sources are checked (lower number = higher priority)
  • Fallback account — an optional code combination to use if the source has no mapping

When creating a journal line, the system walks the derivation rules for the line's type in priority order. At each step it checks whether a source account mapping exists for the given source entity. The first match wins.

Source types​

The following source types are available:

SourceEntity checkedTypical use
CUSTOMER_SITEThe customer site on the AR transactionReceivable and revenue accounts that vary by customer location
SUPPLIER_SITEThe supplier site on the AP transactionPayable and expense accounts that vary by supplier location
ITEMThe inventory item on the transaction lineRevenue or expense accounts that vary by product
TRANSACTION_TYPEThe transaction type (invoice, credit memo, etc.)Accounts that vary by document type
BANK_ACCOUNT_USEThe bank account on the cash receipt or paymentCash accounts for different bank accounts
TAX_RATEThe tax rate applied to the transaction lineTax liability and tax recoverable accounts
LEDGER_DEFAULTThe ledger itselfCatch-all default accounts

Standard method rules​

The seeded STANDARD (Standard Accrual) accounting method defines the following derivation rules:

AR line types​

Line typePriority 1Priority 2Priority 3
RECEIVABLECustomer siteLedger default—
REVENUEItemCustomer siteLedger default
TAX_LIABILITYTax rate——
CASHBank account use——
UNAPPLIEDLedger default——
REALISED_GAINLedger default——
REALISED_LOSSLedger default——

AP line types​

Line typePriority 1Priority 2Priority 3
PAYABLESupplier siteLedger default—
EXPENSEItemSupplier siteLedger default
TAX_RECOVERABLETax rate——

Source accounts​

A source account is the mapping record that derivation rules search. Each source account links:

  • A source type (e.g. CUSTOMER_SITE)
  • A source entity (e.g. a specific customer site ID)
  • A line type (e.g. RECEIVABLE)
  • A GL code combination (the account to use)

For example, to post all receivables for customer site "Auckland Office" to account 100-1200-000, you create a source account with source type CUSTOMER_SITE, the site's ID, line type RECEIVABLE, and the code combination for 100-1200-000.

Resolution example​

When creating a RECEIVABLE line for an AR invoice:

  1. Priority 1 — Customer site: Look up source accounts where source_type = 'CUSTOMER_SITE', source_id = the transaction's customer site, and line_type = 'RECEIVABLE'. If found, use that code combination.
  2. Priority 2 — Ledger default: Look up source accounts where source_type = 'LEDGER_DEFAULT', source_id = the ledger ID, and line_type = 'RECEIVABLE'. If found, use that code combination.
  3. Fallback: If neither rule resolves, check the rule's fallback_ccid. If still unresolved, raise error FSL-00010.

Ledger defaults​

Ledger defaults are the last resort in the derivation chain. They provide a catch-all account for each line type, ensuring that accounting can always proceed even when more specific mappings have not been configured. Ledger defaults use source type LEDGER_DEFAULT with the ledger ID as the source entity.

At a minimum, you should configure ledger defaults for: RECEIVABLE, REVENUE, PAYABLE, EXPENSE, UNAPPLIED, REALISED_GAIN, and REALISED_LOSS.

Further reading​