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

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

You might want to do this in order to enable breakdown of account activity in a trial balance.

Using the LUSID web app

  1. Sign in to the LUSID web app as a user with suitable permissions.

  2. From the top left menu, select Financial Reporting > Mapping.

  3. On the General Ledger Profiles dashboard, select the parent Chart of Accounts from the dropdown.

  4. Click the Create general ledger profile button and follow the instructions.

You can add as many mappings to a general ledger profile as you like. Note the order is significant; LUSID uses the first matching mapping found. For information on the syntax and allowed values of a mapping filter expression and level(s), see this article.

Using Luminesce

You can use the Lusid.GeneralLedgerProfile.Writer provider to create a general ledger profile and then the Lusid.GeneralLedgerProfile.Mapping.Writer provider to set mappings.

Using the LUSID API

  1. Obtain an API access token.

  2. Call the CreateGeneralLedgerProfile API, specifying the scope and code of the parent CoA in the URL and, in the body of the request:

    • A generalLedgerProfileCode that uniquely identifies the general ledger profile in the CoA.

    • A displayName and, optionally, a description. Note these are informational fields only.

    • In the generalLedgerProfileMappings collection, a set of mappings that match journal entry lines to levels (that is, categories to divide accounts into). Note the order in which mappings are specified is significant; LUSID uses the first matching mapping found. Each mapping must consist 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

Note: Once a general ledger profile is created, you cannot change the code, display name 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.

Consider the following example, of a general ledger profile added to a CoA with a scope of Abor and code of Standard (in the URL), and a code itself of STEM (in the body). The profile has three mappings, evaluated in the order specified. Note the third mapping with a mappingFilter expression of True is a 'catch all' rule that applies levels to unmatched journal entry lines; without this, unmatched journal entry lines would not have any levels:

curl -X POST 'https://<your-domain>.lusid.com/api/api/chartofaccounts/Abor/Standard/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"
      ]
    }
  ]
}'

In the response, LUSID confirms the unique identifier of the general ledger profile in the CoA:

{
  "chartOfAccountsId": {
    "scope": "Abor",
    "code": "Standard"
  },
  "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",
        "Properties[Portfolio/Ibor/Region]"
      ]
    },
    {
      "mappingFilter": "True",
      "levels": [
        "Instrument.AssetClass"
      ]
    }
  ],
  ...
}