How do I add a general ledger profile with mappings to a chart of accounts?

Prev Next

You can add one or more general ledger profiles, each containing any number of mappings, to an existing chart of accounts (CoA).

Note the order in which mappings are specified in a profile is significant. For each journal entry line, LUSID uses the first matching mapping found to assign journal entry lines to levels in order to break down account activity in a trial balance.

Methods

Call the CreateGeneralLedgerProfile API.

Note in this example, the third mapping with a mappingFilter expression set to True is a 'catch all' that applies levels to hitherto unmatched journal entry lines; without this, unmatched journal entry lines would have no levels:

curl -X POST 'https://<your-domain>.lusid.com/api/api/chartofaccounts/CoAs/DailyCoA/generalledgerprofile'
  -H 'Content-Type: application/json-patch+json'
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "generalLedgerProfileCode": "STEM",
  "displayName": "STEM",
  "description": "STEM profile",
  "generalLedgerProfileMappings": [
    {
      "mappingFilter": "GeneralLedgerAccountCode eq '1-Investments'",
      "levels": [
        "DefaultCurrency"
      ]
    },
    {
      "mappingFilter": "EconomicBucket startswith 'PL_' and Properties[Instrument/default/LusidInstrumentId] startswith 'CCY_'",
      "levels": [
        "SourceType", "EconomicBucket", "ActivityDate"
      ]
    },
    {
      "mappingFilter": "True",
      "levels": [
        "Instrument.AssetClass"
      ]
    }
  ]
}'

Navigate to Fund Accounting > Chart of Accounts, open the General Ledger Profiles tab, select the parent CoA and click the Create general ledger profile button:

Write a Luminesce SQL query using the Lusid.GeneralLedgerProfile.Writer provider to create a general ledger profile and the Lusid.GeneralLedgerProfile.Mapping.Writer provider to set mappings, and execute the query using a tool such as the LUSID web app:

Data fields

This section supplements the API documentation and on-screen help text in the LUSID web app.

A profile is identified by a code that must be unique within the parent CoA.

You can specify any number of generalLedgerProfileMappings that match journal entry lines to levels (that is, categories to divide accounts into). Note the order is significant. Each mapping consists of:

  • A mappingFilter expression that describes criteria for matching journal entry lines.

  • Up to five levels to apply to journal entry lines matching those criteria, specified as an ordered list of strings. Syntax and allowed values.

Subsequent updates

Once a profile is created, you cannot change the code, displayName or description.

You can specify a new ordered set of mappings using the SetGeneralLedgerProfileMappings API; note the new set replaces the existing set, so include any mappings you want to retain in the request.

You can change the order of mappings in the LUSID web app using the grab handles (in red). You cannot currently patch a profile using the LUSID API.

To delete a profile, call the DeleteGeneralLedgerProfile API.

Syntax of a general ledger profile mapping

Each general ledger profile mapping consists of:

  • A mappingFilter expression that describes criteria for matching journal entry lines. See below.

  • Up to five levels to apply to journal entry lines matching those criteria, specified as an ordered list. More information.

Mapping filter expressions

The syntax of a mappingFilter expression is:

<attribute> <operator> <value>

...where:

Note the following:

  • A mappingFilter expression is case-insensitive.

  • A string <value> must be enclosed in single straight quote marks (the %27 UTF-8 encoding).

  • You can concatenate expressions using the and and or operators, for example:
    GeneralLedgerAccountCode eq '1-Investments' and subholdingkeys[Transaction/Ibor/Strategy] eq 'Income'


    If you use both, standard boolean operator precedence applies:
    EconomicBucket startswith 'NA' or (DefaultCurrency in 'GBP', 'USD' and HoldType eq 'P')

Levels

You can specify up to five levels as an ordered, comma-separated list of strings. In the following example, Instrument.AssetClass is the first (or most significant) level, and Account.type the last (or least):

["Instrument.assetClass", "Properties[Portfolio/Ibor/Region]", "DefaultCurrency", "EconomicBucket", "Account.type"]

Available <levels>

Syntax example

Notes

ActivityDate

For a journal entry line originating from a transaction, this is the trade date. For a journal entry line originating from a valuation, this is the date of the latest detected change to market data.

EconomicBucket

LUSID automatically categorises a journal entry line into a broad economic bucket. More information.

DefaultCurrency

The currency of the instrument underlying the journal entry line, if specified.

A sub-holding key on a portfolio

subholdingkeys[Transaction/Ibor/Strategy]

Under-the-hood, a SHK is defined as a custom property with a 3-stage key in the Transaction domain.

A portfolio field

Portfolio.display

NamePortfolio.parentPortfolioId.Code

This can be any of the stored fields for a portfolio except the href, links and version fields, prefixed by Portfolio. Nested fields can be accessed using dot notation.

A portfolio property

properties[Portfolio/Ibor/Manager]

This can be any property with a 3-stage key in the Portfolio domain.

An instrument field

Instrument.identifiers['LusidInstrumentId']

Instrument.instrumentDefinition.instrumentType

This can be any of the stored fields for an instrument except the href, links and version fields, prefixed by Instrument. Nested fields can be accessed using dot notation.

An instrument property

properties[Instrument/Ibor/AnalystRating]

This can be any property with a 3-stage key in the Instrument domain.

A transaction field

Transaction.typeTransaction.transactionDate

This can be any of the stored fields for a transaction, prefixed by Transaction. Nested fields can be accessed using dot notation.

A transaction property

properties[Transaction/Ibor/Broker]

This can be any property with a 3-stage key in the Transaction domain.

An account field

Account.type

This can be any of the stored fields for an account, prefixed by Account. Nested fields can be accessed using dot notation.

An account property

properties[Account/Type/AssetClass]

This can be any property with a 3-stage key in the Account domain.

A fund property

properties[Fund/Managers/Name] eq 'Fred Bloggs'

This can be any property with a 3-stage key in the Fund domain.

An ABOR property (V1 funds only)

properties[Abor/Client/Accountant] not in 'Fred Bloggs', 'Sarah Smart'

This can be any property with a 3-stage key in the Abor domain.