Skip to main content

Actions

The ballerinax/microsoft.dynamics365.finance.ledger package exposes the following clients:

ClientPurpose
ClientProvides full CRUD access to Microsoft Dynamics 365 Finance Ledger entities via the OData REST API.

Client

Provides full CRUD access to Microsoft Dynamics 365 Finance Ledger entities via the OData REST API.

Configuration

FieldTypeDefaultDescription
authOAuth2ClientCredentialsGrantConfigRequiredOAuth2 client credentials grant configuration used to authenticate with Microsoft Entra ID (tokenUrl, clientId, clientSecret, scopes).
httpVersionhttp:HttpVersionhttp:HTTP_2_0The HTTP version understood by the client.
http1Settingshttp:ClientHttp1Settings{}Configurations related to the HTTP/1.x protocol.
secureSockethttp:ClientSecureSocket()SSL/TLS-related options.
proxyhttp:ProxyConfig()Proxy server related options.

Initializing the client

import ballerinax/microsoft.dynamics365.finance.ledger;

configurable string tokenUrl = ?;
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string serviceUrl = ?;

ledger:Client fo = check new (
{
auth: {
tokenUrl,
clientId,
clientSecret
}
},
serviceUrl
);

Operations

Accountants

listAccountants

Lists ledger accountant registration records.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListAccountantsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: AccountantsCollection|error

Sample code:

ledger:AccountantsCollection result = check fo->listAccountants(
queries = {
filter: "AccountantName eq 'Maria Souza'",
top: 10
}
);
createAccountants

Creates a ledger accountant registration record.

Parameters:

NameTypeRequiredDescription
payloadAccountantYesThe accountant record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: Accountant|error

Sample code:

ledger:Accountant created = check fo->createAccountants({
accountantName: "Maria Souza",
cPF: "12345678900",
cRC: "1SP123456",
cNPJ: "12345678000199",
addressStreet: "Av. Paulista",
addressCityName: "Sao Paulo",
addressState: "SP",
addressZipCode: "01311-000"
});
getAccountants

Retrieves a specific ledger accountant registration record by its CPF and CRC key.

Parameters:

NameTypeRequiredDescription
cPFstringYesThe accountant's CPF (Brazilian individual taxpayer registry number).
cRCstringYesThe accountant's CRC (regional accounting council registration number).
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetAccountantsQueriesNoOData query parameters: expand, 'select.

Returns: Accountant|error

Sample code:

ledger:Accountant accountant = check fo->getAccountants("12345678900", "1SP123456");
deleteAccountants

Deletes a specific ledger accountant registration record.

Parameters:

NameTypeRequiredDescription
cPFstringYesThe accountant's CPF.
cRCstringYesThe accountant's CRC.
headersDeleteAccountantsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteAccountants("12345678900", "1SP123456", {ifMatch: eTag});
updateAccountants

Updates a specific ledger accountant registration record.

Parameters:

NameTypeRequiredDescription
cPFstringYesThe accountant's CPF.
cRCstringYesThe accountant's CRC.
payloadAccountantYesThe fields to update.
headersUpdateAccountantsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: Accountant|error

Sample code:

ledger:Accountant updated = check fo->updateAccountants(
"12345678900",
"1SP123456",
{addressCityName: "Rio de Janeiro", addressState: "RJ"},
{ifMatch: eTag}
);

Accrual schemes

listAccrualSchemes

Lists accrual schemes used to spread revenue and expense recognition across periods.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListAccrualSchemesQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: AccrualSchemesCollection|error

Sample code:

ledger:AccrualSchemesCollection result = check fo->listAccrualSchemes(
queries = {
filter: "dataAreaId eq 'USMF'"
}
);
createAccrualSchemes

Creates an accrual scheme.

Parameters:

NameTypeRequiredDescription
payloadAccrualSchemeYesThe accrual scheme record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: AccrualScheme|error

Sample code:

ledger:AccrualScheme created = check fo->createAccrualSchemes({
dataAreaId: "USMF",
accrualIdentification: "RENT-ACCR",
accrualSchemeDescription: "Monthly rent accrual",
accrualBasis: "Calendar",
calendarPeriodFrequency: "Monthly",
numberOfOccurrencesPerPeriod: 1,
postTransactions: "Month",
voucher: "Single",
debitLedgerDimensionDisplayValue: "601100-USMF-001",
creditLedgerDimensionDisplayValue: "220100-USMF-001"
});
getAccrualSchemes

Retrieves a specific accrual scheme by company and accrual identification.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier (e.g., "USMF").
accrualIdentificationstringYesThe accrual scheme's identification code.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetAccrualSchemesQueriesNoOData query parameters: expand, 'select.

Returns: AccrualScheme|error

Sample code:

ledger:AccrualScheme scheme = check fo->getAccrualSchemes("USMF", "RENT-ACCR");
deleteAccrualSchemes

Deletes a specific accrual scheme.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
accrualIdentificationstringYesThe accrual scheme's identification code.
headersDeleteAccrualSchemesHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteAccrualSchemes("USMF", "RENT-ACCR", {ifMatch: eTag});
updateAccrualSchemes

Updates a specific accrual scheme.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
accrualIdentificationstringYesThe accrual scheme's identification code.
payloadAccrualSchemeYesThe fields to update.
headersUpdateAccrualSchemesHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: AccrualScheme|error

Sample code:

ledger:AccrualScheme updated = check fo->updateAccrualSchemes(
"USMF",
"RENT-ACCR",
{numberOfOccurrencesPerPeriod: 2},
{ifMatch: eTag}
);

Audit trails

listAuditTrails

Lists audit trail records that track ledger transactions for compliance and traceability.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListAuditTrailsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: AuditTrailsCollection|error

Sample code:

ledger:AuditTrailsCollection result = check fo->listAuditTrails(
queries = {
filter: "dataAreaId eq 'USMF' and TransactionType eq 'LedgerJournal'",
orderby: "CreatedTransactionDateTime desc"
}
);
createAuditTrails

Creates an audit trail record.

Parameters:

NameTypeRequiredDescription
payloadAuditTrailYesThe audit trail record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: AuditTrail|error

Sample code:

ledger:AuditTrail created = check fo->createAuditTrails({
dataAreaId: "USMF",
transactionId: 100234,
transactionType: "LedgerJournal",
description: "Manual correction of freight accrual",
createdByUser: "admin",
createdTransactionDateTime: "2026-01-15T10:30:00Z"
});
getAuditTrails

Retrieves a specific audit trail record by company and transaction ID.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
transactionIdintYesThe transaction ID of the audit trail entry.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetAuditTrailsQueriesNoOData query parameters: expand, 'select.

Returns: AuditTrail|error

Sample code:

ledger:AuditTrail trail = check fo->getAuditTrails("USMF", 100234);
deleteAuditTrails

Deletes a specific audit trail record.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
transactionIdintYesThe transaction ID of the audit trail entry.
headersDeleteAuditTrailsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteAuditTrails("USMF", 100234, {ifMatch: eTag});
updateAuditTrails

Updates a specific audit trail record.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
transactionIdintYesThe transaction ID of the audit trail entry.
payloadAuditTrailYesThe fields to update.
headersUpdateAuditTrailsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: AuditTrail|error

Sample code:

ledger:AuditTrail updated = check fo->updateAuditTrails(
"USMF",
100234,
{description: "Reviewed and confirmed by controller"},
{ifMatch: eTag}
);

Ledger intervals

listLedgerIntervals

Lists ledger account number intervals used for security and reporting scoping.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListLedgerIntervalsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: LedgerIntervalsCollection|error

Sample code:

ledger:LedgerIntervalsCollection result = check fo->listLedgerIntervals(
queries = {
filter: "dataAreaId eq 'USMF'"
}
);
createLedgerIntervals

Creates a ledger account number interval.

Parameters:

NameTypeRequiredDescription
payloadLedgerIntervalYesThe ledger interval record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: LedgerInterval|error

Sample code:

ledger:LedgerInterval created = check fo->createLedgerIntervals({
dataAreaId: "USMF",
intervalGroup: "CASHACCTS",
fromAccount: "110100",
toAccount: "110199",
fromLedgerChartOfAccounts: "USMF-COA",
toLedgerChartOfAccounts: "USMF-COA"
});
getLedgerIntervals

Retrieves a specific ledger interval by its composite key.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
intervalGroupstringYesThe interval group identifier.
fromAccountstringYesThe starting main account number of the interval.
toAccountstringYesThe ending main account number of the interval.
fromLedgerChartOfAccountsstringYesThe chart of accounts of the starting account.
toLedgerChartOfAccountsstringYesThe chart of accounts of the ending account.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetLedgerIntervalsQueriesNoOData query parameters: expand, 'select.

Returns: LedgerInterval|error

Sample code:

ledger:LedgerInterval interval = check fo->getLedgerIntervals(
"USMF", "CASHACCTS", "110100", "110199", "USMF-COA", "USMF-COA"
);
deleteLedgerIntervals

Deletes a specific ledger interval.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
intervalGroupstringYesThe interval group identifier.
fromAccountstringYesThe starting main account number of the interval.
toAccountstringYesThe ending main account number of the interval.
fromLedgerChartOfAccountsstringYesThe chart of accounts of the starting account.
toLedgerChartOfAccountsstringYesThe chart of accounts of the ending account.
headersDeleteLedgerIntervalsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteLedgerIntervals(
"USMF", "CASHACCTS", "110100", "110199", "USMF-COA", "USMF-COA",
{ifMatch: eTag}
);
updateLedgerIntervals

Updates a specific ledger interval.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
intervalGroupstringYesThe interval group identifier.
fromAccountstringYesThe starting main account number of the interval.
toAccountstringYesThe ending main account number of the interval.
fromLedgerChartOfAccountsstringYesThe chart of accounts of the starting account.
toLedgerChartOfAccountsstringYesThe chart of accounts of the ending account.
payloadLedgerIntervalYesThe fields to update.
headersUpdateLedgerIntervalsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: LedgerInterval|error

Sample code:

ledger:LedgerInterval updated = check fo->updateLedgerIntervals(
"USMF", "CASHACCTS", "110100", "110199", "USMF-COA", "USMF-COA",
{toAccount: "110210"},
{ifMatch: eTag}
);

Ledger journal descriptions

listLedgerJournalDescriptions

Lists ledger journal names used to categorize journals.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListLedgerJournalDescriptionsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: LedgerJournalDescriptionsCollection|error

Sample code:

ledger:LedgerJournalDescriptionsCollection result = check fo->listLedgerJournalDescriptions(
queries = {
filter: "dataAreaId eq 'USMF'"
}
);
createLedgerJournalDescriptions

Creates a ledger journal name.

Parameters:

NameTypeRequiredDescription
payloadLedgerJournalDescriptionYesThe journal name record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: LedgerJournalDescription|error

Sample code:

ledger:LedgerJournalDescription created = check fo->createLedgerJournalDescriptions({
dataAreaId: "USMF",
identification: "GENJRN",
description: "General journal",
searchName: "General journal"
});
getLedgerJournalDescriptions

Retrieves a specific ledger journal name by company and identification.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
identificationstringYesThe journal name's identification code.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetLedgerJournalDescriptionsQueriesNoOData query parameters: expand, 'select.

Returns: LedgerJournalDescription|error

Sample code:

ledger:LedgerJournalDescription journalName = check fo->getLedgerJournalDescriptions("USMF", "GENJRN");
deleteLedgerJournalDescriptions

Deletes a specific ledger journal name.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
identificationstringYesThe journal name's identification code.
headersDeleteLedgerJournalDescriptionsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteLedgerJournalDescriptions("USMF", "GENJRN", {ifMatch: eTag});
updateLedgerJournalDescriptions

Updates a specific ledger journal name.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
identificationstringYesThe journal name's identification code.
payloadLedgerJournalDescriptionYesThe fields to update.
headersUpdateLedgerJournalDescriptionsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: LedgerJournalDescription|error

Sample code:

ledger:LedgerJournalDescription updated = check fo->updateLedgerJournalDescriptions(
"USMF",
"GENJRN",
{description: "General journal - all departments"},
{ifMatch: eTag}
);

Ledger journal headers

listLedgerJournalHeaders

Lists ledger journal headers, including their totals and posting status.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListLedgerJournalHeadersQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: LedgerJournalHeadersCollection|error

Sample code:

ledger:LedgerJournalHeadersCollection result = check fo->listLedgerJournalHeaders(
queries = {
filter: "dataAreaId eq 'USMF' and IsPosted eq 'No'"
}
);
createLedgerJournalHeaders

Creates a ledger journal header.

Parameters:

NameTypeRequiredDescription
payloadLedgerJournalHeaderYesThe journal header record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: LedgerJournalHeader|error

Sample code:

ledger:LedgerJournalHeader created = check fo->createLedgerJournalHeaders({
dataAreaId: "USMF",
journalName: "GenJrn",
description: "July accrual adjustments",
accountingCurrency: "USD",
postingLayer: "Current"
});
getLedgerJournalHeaders

Retrieves a specific ledger journal header by company and journal batch number.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalBatchNumberstringYesThe journal batch number.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetLedgerJournalHeadersQueriesNoOData query parameters: expand, 'select.

Returns: LedgerJournalHeader|error

Sample code:

ledger:LedgerJournalHeader journalHeader = check fo->getLedgerJournalHeaders("USMF", "GJ00001234");
deleteLedgerJournalHeaders

Deletes a specific ledger journal header.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalBatchNumberstringYesThe journal batch number.
headersDeleteLedgerJournalHeadersHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteLedgerJournalHeaders("USMF", "GJ00001234", {ifMatch: eTag});
updateLedgerJournalHeaders

Updates a specific ledger journal header.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalBatchNumberstringYesThe journal batch number.
payloadLedgerJournalHeaderYesThe fields to update.
headersUpdateLedgerJournalHeadersHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: LedgerJournalHeader|error

Sample code:

ledger:LedgerJournalHeader updated = check fo->updateLedgerJournalHeaders(
"USMF",
"GJ00001234",
{description: "July accrual adjustments - reviewed"},
{ifMatch: eTag}
);

Opening sheets

listOpeningSheets

Lists opening balance sheet lines used when opening ledger balances for a new fiscal year.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListOpeningSheetsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: OpeningSheetsCollection|error

Sample code:

ledger:OpeningSheetsCollection result = check fo->listOpeningSheets(
queries = {
filter: "dataAreaId eq 'USMF' and Sheet eq 'OPEN-2026'"
}
);
createOpeningSheets

Creates an opening balance sheet line.

Parameters:

NameTypeRequiredDescription
payloadOpeningSheetYesThe opening sheet line record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: OpeningSheet|error

Sample code:

ledger:OpeningSheet created = check fo->createOpeningSheets({
dataAreaId: "USMF",
sheet: "OPEN-2026",
ledgerOpeningTableChartOfAccountsName: "USMF-COA",
ledgerOpeningTableMainAccountIdDisplayValue: "110100",
lineNum: 1,
amount: 25000.00,
accountType: "Asset"
});
getOpeningSheets

Retrieves a specific opening balance sheet line by its composite key.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
sheetstringYesThe opening sheet identifier.
ledgerOpeningTableMainAccountIdDisplayValuestringYesThe main account number of the opening line.
ledgerOpeningTableChartOfAccountsNamestringYesThe chart of accounts of the main account.
lineNumdecimalYesThe line number within the opening sheet.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetOpeningSheetsQueriesNoOData query parameters: expand, 'select.

Returns: OpeningSheet|error

Sample code:

ledger:OpeningSheet line = check fo->getOpeningSheets(
"USMF", "OPEN-2026", "110100", "USMF-COA", 1
);
deleteOpeningSheets

Deletes a specific opening balance sheet line.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
sheetstringYesThe opening sheet identifier.
ledgerOpeningTableMainAccountIdDisplayValuestringYesThe main account number of the opening line.
ledgerOpeningTableChartOfAccountsNamestringYesThe chart of accounts of the main account.
lineNumdecimalYesThe line number within the opening sheet.
headersDeleteOpeningSheetsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deleteOpeningSheets(
"USMF", "OPEN-2026", "110100", "USMF-COA", 1,
{ifMatch: eTag}
);
updateOpeningSheets

Updates a specific opening balance sheet line.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
sheetstringYesThe opening sheet identifier.
ledgerOpeningTableMainAccountIdDisplayValuestringYesThe main account number of the opening line.
ledgerOpeningTableChartOfAccountsNamestringYesThe chart of accounts of the main account.
lineNumdecimalYesThe line number within the opening sheet.
payloadOpeningSheetYesThe fields to update.
headersUpdateOpeningSheetsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: OpeningSheet|error

Sample code:

ledger:OpeningSheet updated = check fo->updateOpeningSheets(
"USMF", "OPEN-2026", "110100", "USMF-COA", 1,
{amount: 27500.00},
{ifMatch: eTag}
);

Posting definitions

listPostingDefinitions

Lists posting definitions that drive automated subledger postings.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListPostingDefinitionsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: PostingDefinitionsCollection|error

Sample code:

ledger:PostingDefinitionsCollection result = check fo->listPostingDefinitions(
queries = {
filter: "dataAreaId eq 'USMF' and Module eq 'AccountsPayable'"
}
);
createPostingDefinitions

Creates a posting definition.

Parameters:

NameTypeRequiredDescription
payloadPostingDefinitionYesThe posting definition record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: PostingDefinition|error

Sample code:

ledger:PostingDefinition created = check fo->createPostingDefinitions({
dataAreaId: "USMF",
postingDefinitionId: "AP-INV",
description: "Accounts payable invoice posting",
'module: "AccountsPayable",
validFrom: "2026-01-01",
validTo: "2154-12-31"
});
getPostingDefinitions

Retrieves a specific posting definition by its composite key.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
postingDefinitionIdstringYesThe posting definition's identifier.
validFromstringYesThe start date of the posting definition's validity period.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetPostingDefinitionsQueriesNoOData query parameters: expand, 'select.

Returns: PostingDefinition|error

Sample code:

ledger:PostingDefinition definition = check fo->getPostingDefinitions("USMF", "AP-INV", "2026-01-01");
deletePostingDefinitions

Deletes a specific posting definition.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
postingDefinitionIdstringYesThe posting definition's identifier.
validFromstringYesThe start date of the posting definition's validity period.
headersDeletePostingDefinitionsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deletePostingDefinitions("USMF", "AP-INV", "2026-01-01", {ifMatch: eTag});
updatePostingDefinitions

Updates a specific posting definition.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
postingDefinitionIdstringYesThe posting definition's identifier.
validFromstringYesThe start date of the posting definition's validity period.
payloadPostingDefinitionYesThe fields to update.
headersUpdatePostingDefinitionsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: PostingDefinition|error

Sample code:

ledger:PostingDefinition updated = check fo->updatePostingDefinitions(
"USMF",
"AP-INV",
"2026-01-01",
{description: "Accounts payable invoice posting - revised"},
{ifMatch: eTag}
);

Posting journals

listPostingJournals

Lists posting journal number sequences used for journal batch numbering.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesListPostingJournalsQueriesNoOData query parameters: skip, top, filter, orderby, expand, crossCompany (cross-company), count, 'select.

Returns: PostingJournalsCollection|error

Sample code:

ledger:PostingJournalsCollection result = check fo->listPostingJournals(
queries = {
filter: "dataAreaId eq 'USMF'"
}
);
createPostingJournals

Creates a posting journal number sequence.

Parameters:

NameTypeRequiredDescription
payloadPostingJournalYesThe posting journal record to create.
headersmap<string|string[]>NoAdditional HTTP request headers.

Returns: PostingJournal|error

Sample code:

ledger:PostingJournal created = check fo->createPostingJournals({
dataAreaId: "USMF",
journal: "GenJrn",
numberSequenceCode: "GJ_USMF",
name: "General journal batch numbers",
journalType: "Financial",
fromDate: "2026-01-01",
toDate: "2026-12-31"
});
getPostingJournals

Retrieves a specific posting journal number sequence by its composite key.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalstringYesThe journal type identifier.
numberSequenceCodestringYesThe number sequence code assigned to the journal.
headersmap<string|string[]>NoAdditional HTTP request headers.
queriesGetPostingJournalsQueriesNoOData query parameters: expand, 'select.

Returns: PostingJournal|error

Sample code:

ledger:PostingJournal postingJournal = check fo->getPostingJournals("USMF", "GenJrn", "GJ_USMF");
deletePostingJournals

Deletes a specific posting journal number sequence.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalstringYesThe journal type identifier.
numberSequenceCodestringYesThe number sequence code assigned to the journal.
headersDeletePostingJournalsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: error?

Sample code:

check fo->deletePostingJournals("USMF", "GenJrn", "GJ_USMF", {ifMatch: eTag});
updatePostingJournals

Updates a specific posting journal number sequence.

Parameters:

NameTypeRequiredDescription
dataAreaIdstringYesThe company data area identifier.
journalstringYesThe journal type identifier.
numberSequenceCodestringYesThe number sequence code assigned to the journal.
payloadPostingJournalYesThe fields to update.
headersUpdatePostingJournalsHeadersNoRequest headers, including an optional ifMatch ETag for optimistic concurrency.

Returns: PostingJournal|error

Sample code:

ledger:PostingJournal updated = check fo->updatePostingJournals(
"USMF",
"GenJrn",
"GJ_USMF",
{toDate: "2027-12-31"},
{ifMatch: eTag}
);