How do I add a cleardown module with cleardown rules to a chart of accounts?

You can add one or more cleardown modules containing cleardown rules to an existing chart of accounts (CoA).

You might do this in order to transfer balances in P&L accounts to other accounts at year end.

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 Cleardown Modules dashboard, select the parent Chart of Accounts from the dropdown.

  4. Click the Create cleardown module button and follow the instructions to create the module itself:

You can add cleardown rules in the Create Cleardown Module dialog above, but it might be easier to navigate to the Cleardown Rules dashboard instead, selecting the Chart of Accounts and the empty Cleardown Module from their respective dropdowns, and then clicking the Create cleardown rule button (see below).

You can add as many cleardown rules to a cleardown module as you like. Note the order is significant; LUSID uses the first matching cleardown rule found. For information on the syntax and allowed values of a rule filter expression, see this section.

Using Luminesce

You can use the Lusid.CleardownModule.Writer provider to create a cleardown module and then the Lusid.CleardownModule.Rule.Writer provider to set cleardown rules.

Using the LUSID API

  1. Obtain an API access token.

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

    • A code that uniquely identifies the cleardown module in the CoA.

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

    • In the rules collection, a set of cleardown rules. Note the order in which cleardown rules are specified is significant; LUSID uses the first matching cleardown rule found. Each cleardown rule must consist of:

      • A ruleId that uniquely identifies the cleardown rule in the cleardown module.

      • generalLedgerAccountCode to post the credit or debit to.

      • A ruleFilter expression. Syntax and allowed values

Note: Once a cleardown module is created, you can change the display name, description and status using the SetCleardownModuleDetails API. You can specify a new set of cleardown rules using the SetCleardownModuleRules API. Note calls to these APIs replace existing information, so include any fields you want to retain.

Consider the following example, of a cleardown module added to a CoA that has a scope of Abor and code of Standard (in the URL). The cleardown module itself has a code of EoY (in the body), and three cleardown rules that are evaluated in the order specified:

curl -X POST 'https://<your-domain>.lusid.com/api/api/chartofaccounts/Abor/Standard/cleardownmodules'
  -H 'Content-Type: application/json-patch+json' 
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "code": "EoY",
  "displayName": "End of year cleardown module",
  "description": "This is a cleardown module for end of year",
  "rules": [
    {
      "ruleId": "rule_10001",
      "generalLedgerAccountCode": "1-Investments",
      "ruleFilter": "Account.Code startswith '200'"
    },
    {
      "ruleId": "rule_10002",
      "generalLedgerAccountCode": "2-Cash",
      "ruleFilter": "Account.Type in 'Income','Expense','Revenue'"
    },
    {
      "ruleId": "rule_10003",
      "generalLedgerAccountCode": "3-Subscriptions",
      "ruleFilter": "Properties[Account/MyScope/Cleardown] exists and Properties[Abor/MyScope/Region] eq 'EMEA'"
    }
  ]
}'

In the response, LUSID confirms the unique identifier of the cleardown module in the CoA:

{
  "cleardownModuleCode": "EoY",
  "chartOfAccountsId": {
    "scope": "Abor",
    "code": "Standard"
  },
  "displayName": "End of year cleardown module",
  ...
}

Syntax of a cleardown rule

The syntax of a ruleFilter expression in a cleardown rule is:

<attribute> <operator> <value>

...where:

Note the following:

  • A ruleFilter 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. If you use both, standard boolean operator precedence applies.

<attribute>

Data type

Example expression

Explanation/origin of <value>

An account field

System-defined

Account.type in 'Asset', 'Liabilities'

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

User-defined

properties[Account/Type/AssetClass] eq 'Equity'

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

An ABOR property

User-defined

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

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