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.
Using the LUSID web app
Coming soon
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
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.
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:
<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.
| Data type | Example expression | Explanation/origin of |
---|---|---|---|
An account field | System-defined |
| This can be any of the stored fields for an account, prefixed by |
An account property | User-defined |
| This can be any property with a 3-stage key in the |
An ABOR property | User-defined |
| This can be any property with a 3-stage key in the |