Views:

Related resources:

Explanation

Tutorials

Reference

Providing you have suitable access control permissions, 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.

The following methods are available:

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 (highlighted in red in the URL). The cleardown module itself has a code of EoY (in yellow 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 (highlighted in red):

{
  "cleardownModuleCode": "EoY",
  "chartOfAccountsId": {
    "scope": "Abor",
    "code": "Standard"
  },
  "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'"
    }
  ],
  "status": "Active",
  ...
}

Using the LUSID web app

Coming soon

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 typeExample expressionExplanation/origin of <value>
An account fieldSystem-definedAccount.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 propertyUser-definedproperties[Account/Type/AssetClass] eq 'Equity'This can be any property with a 3-stage key in the Account domain.
An ABOR propertyUser-definedproperties[Abor/Client/Accountant] not in 'Fred Bloggs', 'Sarah Smart'This can be any property with a 3-stage key in the Abor domain.