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:
- Method 1: Using the LUSID API
- Method 2: Using the LUSID web app
- Method 3: Using Luminesce
Using the LUSID API
- Obtain an API access token.
- 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, adescription
. 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. - A
generalLedgerAccountCode
to post the credit or debit to. - A
ruleFilter
expression. Syntax and allowed values.
- A
- A
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:
<attribute>
and<value>
are explained in the table below.<operator>
is one of the LUSID filter operators.
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
andor
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. |