Actions
The ballerinax/microsoft.dynamics365.finance.trade package exposes the following clients:
| Client | Purpose |
|---|---|
Client | Provides full CRUD access to Microsoft Dynamics 365 Finance Trade entities via the OData REST API. |
Client
Provides full CRUD access to Microsoft Dynamics 365 Finance Trade entities via the OData REST API.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
auth | OAuth2ClientCredentialsGrantConfig | Required | OAuth2 client credentials grant configuration used to obtain an access token from Microsoft Entra ID. |
httpVersion | string | "2.0" | HTTP protocol version to use for outbound requests. |
http1Settings | ClientHttp1Settings | {} | HTTP/1.x client settings including keep-alive, chunking, and proxy configuration. |
secureSocket | http:ClientSecureSocket | () | SSL/TLS configuration for secure connections. |
proxy | ProxyConfig | () | Proxy server configuration. |
Initializing the client
import ballerinax/microsoft.dynamics365.finance.trade;
configurable string tokenUrl = ?;
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string serviceUrl = ?;
trade:Client fo = check new (
{
auth: {
tokenUrl,
clientId,
clientSecret
}
},
serviceUrl
);
Operations
BLWI
listBLWI
Reads all BLWI (foreign trade payment) records in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListBLWIQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:BLWICollection|error
Sample code:
trade:BLWICollection result = check fo->listBLWI(
queries = {
filter: "Currency eq 'EUR'",
top: 20,
'select: "Voucher,Invoice,Amount,Currency"
}
);
createBLWI
Creates a BLWI record.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | BLWI | Yes | The BLWI record to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:BLWI|error
Sample code:
trade:BLWI created = check fo->createBLWI({
dataAreaId: "ESMF",
company: "ESMF",
bLWITransaction: "Vendor",
accountNumber: "ES-100234",
voucher: "VouchNo-000123",
invoice: "INV-000456",
transactionDate: "2026-01-15",
amount: 15000.00,
currency: "EUR",
countryRegionId: "FRA",
purposeCode: "GOODS"
});
getBLWI
Reads a specific BLWI record.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
company | string | Yes | The company key field. |
bLWITransaction | string | Yes | The BLWI transaction key field ("Customer" or "Vendor"). |
accountNumber | string | Yes | The account number key field. |
voucher | string | Yes | The voucher key field. |
invoice | string | Yes | The invoice key field. |
transactionDate | string | Yes | The transaction date key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetBLWIQueries | No | OData query parameters: $expand, $select. |
Returns: trade:BLWI|error
Sample code:
trade:BLWI record = check fo->getBLWI(
"ESMF", "ESMF", "Vendor", "ES-100234", "VouchNo-000123", "INV-000456", "2026-01-15"
);
deleteBLWI
Deletes a specific BLWI record.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
company | string | Yes | The company key field. |
bLWITransaction | string | Yes | The BLWI transaction key field. |
accountNumber | string | Yes | The account number key field. |
voucher | string | Yes | The voucher key field. |
invoice | string | Yes | The invoice key field. |
transactionDate | string | Yes | The transaction date key field. |
headers | DeleteBLWIHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteBLWI(
"ESMF", "ESMF", "Vendor", "ES-100234", "VouchNo-000123", "INV-000456", "2026-01-15",
headers = {ifMatch: eTag}
);
updateBLWI
Updates a specific BLWI record.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
company | string | Yes | The company key field. |
bLWITransaction | string | Yes | The BLWI transaction key field. |
accountNumber | string | Yes | The account number key field. |
voucher | string | Yes | The voucher key field. |
invoice | string | Yes | The invoice key field. |
transactionDate | string | Yes | The transaction date key field. |
payload | BLWI | Yes | Fields to update. |
headers | UpdateBLWIHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:BLWI|error
Sample code:
trade:BLWI updated = check fo->updateBLWI(
"ESMF", "ESMF", "Vendor", "ES-100234", "VouchNo-000123", "INV-000456", "2026-01-15",
{amount: 15500.00},
headers = {ifMatch: eTag}
);
Intrastats
listIntrastats
Reads all Intrastat declarations in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListIntrastatsQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:IntrastatsCollection|error
Sample code:
trade:IntrastatsCollection result = check fo->listIntrastats(
queries = {
filter: "Direction eq Microsoft.Dynamics.DataEntities.IntrastatDirection'Export'",
top: 25
}
);
createIntrastats
Creates an Intrastat declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | Intrastat | Yes | The Intrastat declaration to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:Intrastat|error
Sample code:
trade:Intrastat created = check fo->createIntrastats({
dataAreaId: "FRMF",
shipmentBatch: "SB-2026-004",
sequenceNumber: 1,
direction: "Export",
itemNumber: "ITEM-2201",
commodity: "84713000",
quantity: 50,
weight: 120.5,
invoiceAmount: 8000.00,
currencyCode: "EUR",
countryRegionId: "DEU",
transactionCode: "10"
});
getIntrastats
Reads a specific Intrastat declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetIntrastatsQueries | No | OData query parameters: $expand, $select. |
Returns: trade:Intrastat|error
Sample code:
trade:Intrastat declaration = check fo->getIntrastats("FRMF", "SB-2026-004", 1);
deleteIntrastats
Deletes a specific Intrastat declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
headers | DeleteIntrastatsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteIntrastats("FRMF", "SB-2026-004", 1, headers = {ifMatch: eTag});
updateIntrastats
Updates a specific Intrastat declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
payload | Intrastat | Yes | Fields to update. |
headers | UpdateIntrastatsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:Intrastat|error
Sample code:
trade:Intrastat updated = check fo->updateIntrastats(
"FRMF", "SB-2026-004", 1,
{quantity: 55, weight: 132.0},
headers = {ifMatch: eTag}
);
Intrastats V2
listIntrastatsV2
Reads all Intrastat V2 declarations in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListIntrastatsV2Queries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:IntrastatsV2Collection|error
Sample code:
trade:IntrastatsV2Collection result = check fo->listIntrastatsV2(
queries = {
filter: "Direction eq Microsoft.Dynamics.DataEntities.IntrastatDirection'Import'",
top: 25
}
);
createIntrastatsV2
Creates an Intrastat V2 declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | IntrastatV2 | Yes | The Intrastat V2 declaration to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:IntrastatV2|error
Sample code:
trade:IntrastatV2 created = check fo->createIntrastatsV2({
dataAreaId: "FRMF",
shipmentBatch: "SB-2026-005",
sequenceNumber: 1,
direction: "Import",
itemNumber: "ITEM-3305",
commodity: "85171200",
quantity: 10,
weight: 22.0,
invoiceAmount: 4200.00,
currencyCode: "EUR",
countryRegionId: "CHN",
transactionCode: "10"
});
getIntrastatsV2
Reads a specific Intrastat V2 declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetIntrastatsV2Queries | No | OData query parameters: $expand, $select. |
Returns: trade:IntrastatV2|error
Sample code:
trade:IntrastatV2 declaration = check fo->getIntrastatsV2("FRMF", "SB-2026-005", 1);
deleteIntrastatsV2
Deletes a specific Intrastat V2 declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
headers | DeleteIntrastatsV2Headers | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteIntrastatsV2("FRMF", "SB-2026-005", 1, headers = {ifMatch: eTag});
updateIntrastatsV2
Updates a specific Intrastat V2 declaration.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
shipmentBatch | string | Yes | The shipment batch key field. |
sequenceNumber | int | Yes | The sequence number key field. |
payload | IntrastatV2 | Yes | Fields to update. |
headers | UpdateIntrastatsV2Headers | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:IntrastatV2|error
Sample code:
trade:IntrastatV2 updated = check fo->updateIntrastatsV2(
"FRMF", "SB-2026-005", 1,
{quantity: 12, weight: 26.4},
headers = {ifMatch: eTag}
);
NAF Codes
listNAFCodes
Reads all NAF (French commodity classification) codes in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListNAFCodesQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:NAFCodesCollection|error
Sample code:
trade:NAFCodesCollection result = check fo->listNAFCodes(
queries = {
filter: "startswith(NAFCode,'47')",
top: 20
}
);
createNAFCodes
Creates a NAF code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | NAFCode | Yes | The NAF code to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:NAFCode|error
Sample code:
trade:NAFCode created = check fo->createNAFCodes({
dataAreaId: "FRMF",
nAFCode: "4711D",
description: "Other retail sale in non-specialized stores"
});
getNAFCodes
Reads a specific NAF code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nAFCode | string | Yes | The NAF code key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetNAFCodesQueries | No | OData query parameters: $expand, $select. |
Returns: trade:NAFCode|error
Sample code:
trade:NAFCode code = check fo->getNAFCodes("FRMF", "4711D");
deleteNAFCodes
Deletes a specific NAF code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nAFCode | string | Yes | The NAF code key field. |
headers | DeleteNAFCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteNAFCodes("FRMF", "4711D", headers = {ifMatch: eTag});
updateNAFCodes
Updates a specific NAF code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nAFCode | string | Yes | The NAF code key field. |
payload | NAFCode | Yes | Fields to update. |
headers | UpdateNAFCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:NAFCode|error
Sample code:
trade:NAFCode updated = check fo->updateNAFCodes(
"FRMF",
"4711D",
{description: "Other retail sale in non-specialized stores (updated)"},
headers = {ifMatch: eTag}
);
NGP Codes
listNGPCodes
Reads all NGP (Spanish commodity classification) codes in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListNGPCodesQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:NGPCodesCollection|error
Sample code:
trade:NGPCodesCollection result = check fo->listNGPCodes(
queries = {
top: 20
}
);
createNGPCodes
Creates an NGP code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | NGPCode | Yes | The NGP code to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:NGPCode|error
Sample code:
trade:NGPCode created = check fo->createNGPCodes({
dataAreaId: "ESMF",
nGP: 6203,
description: "Men's suits and trousers"
});
getNGPCodes
Reads a specific NGP code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nGP | int | Yes | The NGP code key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetNGPCodesQueries | No | OData query parameters: $expand, $select. |
Returns: trade:NGPCode|error
Sample code:
trade:NGPCode code = check fo->getNGPCodes("ESMF", 6203);
deleteNGPCodes
Deletes a specific NGP code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nGP | int | Yes | The NGP code key field. |
headers | DeleteNGPCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteNGPCodes("ESMF", 6203, headers = {ifMatch: eTag});
updateNGPCodes
Updates a specific NGP code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
nGP | int | Yes | The NGP code key field. |
payload | NGPCode | Yes | Fields to update. |
headers | UpdateNGPCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:NGPCode|error
Sample code:
trade:NGPCode updated = check fo->updateNGPCodes(
"ESMF",
6203,
{description: "Men's suits and trousers (updated)"},
headers = {ifMatch: eTag}
);
Report 347
listReport347
Reads all Model 347 report entries in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListReport347Queries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:Report347Collection|error
Sample code:
trade:Report347Collection result = check fo->listReport347(
queries = {
filter: "FiscalYear eq 2026",
top: 20
}
);
createReport347
Creates a Model 347 report entry.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | Report347 | Yes | The Model 347 report entry to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:Report347|error
Sample code:
trade:Report347 created = check fo->createReport347({
dataAreaId: "ESMF",
fiscalYear: 2026,
referenceOfEstate: "EST-001",
invoiceYearForCash: 2026,
taxExemptNumberTrans: "EX-0098",
taskCode: "Sales",
countryRegionTrans: "ESP",
amount: 125000.00,
amountOfSales: 125000.00,
reported: "No"
});
getReport347
Reads a specific Model 347 report entry.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
fiscalYear | int | Yes | The fiscal year key field. |
referenceOfEstate | string | Yes | The reference of estate key field. |
invoiceYearForCash | int | Yes | The invoice year for cash key field. |
taxExemptNumberTrans | string | Yes | The tax exempt number key field. |
taskCode | string | Yes | The task code key field (e.g., "Sales", "Purchase"). |
countryRegionTrans | string | Yes | The country/region key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetReport347Queries | No | OData query parameters: $expand, $select. |
Returns: trade:Report347|error
Sample code:
trade:Report347 report = check fo->getReport347(
"ESMF", 2026, "EST-001", 2026, "EX-0098", "Sales", "ESP"
);
deleteReport347
Deletes a specific Model 347 report entry.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
fiscalYear | int | Yes | The fiscal year key field. |
referenceOfEstate | string | Yes | The reference of estate key field. |
invoiceYearForCash | int | Yes | The invoice year for cash key field. |
taxExemptNumberTrans | string | Yes | The tax exempt number key field. |
taskCode | string | Yes | The task code key field. |
countryRegionTrans | string | Yes | The country/region key field. |
headers | DeleteReport347Headers | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteReport347(
"ESMF", 2026, "EST-001", 2026, "EX-0098", "Sales", "ESP",
headers = {ifMatch: eTag}
);
updateReport347
Updates a specific Model 347 report entry.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
fiscalYear | int | Yes | The fiscal year key field. |
referenceOfEstate | string | Yes | The reference of estate key field. |
invoiceYearForCash | int | Yes | The invoice year for cash key field. |
taxExemptNumberTrans | string | Yes | The tax exempt number key field. |
taskCode | string | Yes | The task code key field. |
countryRegionTrans | string | Yes | The country/region key field. |
payload | Report347 | Yes | Fields to update. |
headers | UpdateReport347Headers | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:Report347|error
Sample code:
trade:Report347 updated = check fo->updateReport347(
"ESMF", 2026, "EST-001", 2026, "EX-0098", "Sales", "ESP",
{reported: "Yes"},
headers = {ifMatch: eTag}
);
Report Periods
listReportPeriods
Reads all report periods in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListReportPeriodsQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:ReportPeriodsCollection|error
Sample code:
trade:ReportPeriodsCollection result = check fo->listReportPeriods(
queries = {
filter: "Approved eq Microsoft.Dynamics.DataEntities.NoYes'No'"
}
);
createReportPeriods
Creates a report period.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | ReportPeriod | Yes | The report period to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:ReportPeriod|error
Sample code:
trade:ReportPeriod created = check fo->createReportPeriods({
dataAreaId: "ESMF",
settlementPeriod: "2026-Q1",
fromDate: "2026-01-01",
toDate: "2026-03-31",
periodStart: "2026-01-01",
periodEnd: "2026-03-31",
approved: "No"
});
getReportPeriods
Reads a specific report period.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
settlementPeriod | string | Yes | The settlement period key field. |
toDate | string | Yes | The period end date key field. |
fromDate | string | Yes | The period start date key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetReportPeriodsQueries | No | OData query parameters: $expand, $select. |
Returns: trade:ReportPeriod|error
Sample code:
trade:ReportPeriod period = check fo->getReportPeriods("ESMF", "2026-Q1", "2026-03-31", "2026-01-01");
deleteReportPeriods
Deletes a specific report period.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
settlementPeriod | string | Yes | The settlement period key field. |
toDate | string | Yes | The period end date key field. |
fromDate | string | Yes | The period start date key field. |
headers | DeleteReportPeriodsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteReportPeriods("ESMF", "2026-Q1", "2026-03-31", "2026-01-01", headers = {ifMatch: eTag});
updateReportPeriods
Updates a specific report period.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
settlementPeriod | string | Yes | The settlement period key field. |
toDate | string | Yes | The period end date key field. |
fromDate | string | Yes | The period start date key field. |
payload | ReportPeriod | Yes | Fields to update. |
headers | UpdateReportPeriodsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:ReportPeriod|error
Sample code:
trade:ReportPeriod updated = check fo->updateReportPeriods(
"ESMF", "2026-Q1", "2026-03-31", "2026-01-01",
{approved: "Yes"},
headers = {ifMatch: eTag}
);
SAD Groups
listSADGroups
Reads all SAD (Single Administrative Document) groups in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListSADGroupsQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:SADGroupsCollection|error
Sample code:
trade:SADGroupsCollection result = check fo->listSADGroups(
queries = {
top: 20
}
);
createSADGroups
Creates a SAD group.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | SADGroup | Yes | The SAD group to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:SADGroup|error
Sample code:
trade:SADGroup created = check fo->createSADGroups({
dataAreaId: "RUMF",
sADGroup: "SAD-STD",
description: "Standard customs declaration group",
vATCode: "VAT20",
duty: 5.5,
excise: 0,
taxGroup: "TAX-STD",
taxItemGroup: "ITEM-STD"
});
getSADGroups
Reads a specific SAD group.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
sADGroup | string | Yes | The SAD group key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetSADGroupsQueries | No | OData query parameters: $expand, $select. |
Returns: trade:SADGroup|error
Sample code:
trade:SADGroup group = check fo->getSADGroups("RUMF", "SAD-STD");
deleteSADGroups
Deletes a specific SAD group.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
sADGroup | string | Yes | The SAD group key field. |
headers | DeleteSADGroupsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteSADGroups("RUMF", "SAD-STD", headers = {ifMatch: eTag});
updateSADGroups
Updates a specific SAD group.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
sADGroup | string | Yes | The SAD group key field. |
payload | SADGroup | Yes | Fields to update. |
headers | UpdateSADGroupsHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:SADGroup|error
Sample code:
trade:SADGroup updated = check fo->updateSADGroups(
"RUMF",
"SAD-STD",
{duty: 6.0},
headers = {ifMatch: eTag}
);
SAD Item Codes
listSADItemCodes
Reads all SAD item codes in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListSADItemCodesQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:SADItemCodesCollection|error
Sample code:
trade:SADItemCodesCollection result = check fo->listSADItemCodes(
queries = {
filter: "startswith(ItemCommodityCode,'8471')"
}
);
createSADItemCodes
Creates a SAD item code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | SADItemCode | Yes | The SAD item code to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:SADItemCode|error
Sample code:
trade:SADItemCode created = check fo->createSADItemCodes({
dataAreaId: "RUMF",
itemCommodityCode: "8471300000",
productName: "Portable computers",
mainAccountDisplayValue: "140100"
});
getSADItemCodes
Reads a specific SAD item code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
itemCommodityCode | string | Yes | The item commodity code key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetSADItemCodesQueries | No | OData query parameters: $expand, $select. |
Returns: trade:SADItemCode|error
Sample code:
trade:SADItemCode code = check fo->getSADItemCodes("RUMF", "8471300000");
deleteSADItemCodes
Deletes a specific SAD item code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
itemCommodityCode | string | Yes | The item commodity code key field. |
headers | DeleteSADItemCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteSADItemCodes("RUMF", "8471300000", headers = {ifMatch: eTag});
updateSADItemCodes
Updates a specific SAD item code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
itemCommodityCode | string | Yes | The item commodity code key field. |
payload | SADItemCode | Yes | Fields to update. |
headers | UpdateSADItemCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:SADItemCode|error
Sample code:
trade:SADItemCode updated = check fo->updateSADItemCodes(
"RUMF",
"8471300000",
{productName: "Portable computers (updated)"},
headers = {ifMatch: eTag}
);
SAD Parameters
listSADParameters
Reads the SAD parameters for every company in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListSADParametersQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:SADParametersCollection|error
Sample code:
trade:SADParametersCollection result = check fo->listSADParameters(
queries = {
crossCompany: true
}
);
createSADParameters
Creates the SAD parameters record for a company.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | SADParameters | Yes | The SAD parameter fields to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:SADParameters|error
Sample code:
trade:SADParameters created = check fo->createSADParameters({
dataAreaId: "RUMF",
additionalCostsFormInvoice: "Item",
miscPayments: "Costs",
transportAccountDisplayValue: "601500",
insuranceAccountDisplayValue: "601600",
dutyRounding: 0.01,
vATRounding: 0.01,
exciseTaxRounding: 0.01
});
getSADParameters
Reads the SAD parameters for a specific company.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetSADParametersQueries | No | OData query parameters: $expand, $select. |
Returns: trade:SADParameters|error
Sample code:
trade:SADParameters parameters = check fo->getSADParameters("RUMF");
deleteSADParameters
Deletes the SAD parameters record for a specific company.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
headers | DeleteSADParametersHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteSADParameters("RUMF", headers = {ifMatch: eTag});
updateSADParameters
Updates the SAD parameters record for a specific company.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
payload | SADParameters | Yes | Fields to update. |
headers | UpdateSADParametersHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:SADParameters|error
Sample code:
trade:SADParameters updated = check fo->updateSADParameters(
"RUMF",
{dutyRounding: 0.05},
headers = {ifMatch: eTag}
);
TNVED Codes
listTNVEDCodes
Reads all TNVED (Eurasian Customs Union commodity classification) codes in the system.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | ListTNVEDCodesQueries | No | OData query parameters: $skip, $top, $filter, $orderby, $expand, cross-company, $count, $select. |
Returns: trade:TNVEDCodesCollection|error
Sample code:
trade:TNVEDCodesCollection result = check fo->listTNVEDCodes(
queries = {
filter: "Blocked eq Microsoft.Dynamics.DataEntities.NoYes'No'",
top: 20
}
);
createTNVEDCodes
Creates a TNVED code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
payload | TNVEDCode | Yes | The TNVED code to create. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
Returns: trade:TNVEDCode|error
Sample code:
trade:TNVEDCode created = check fo->createTNVEDCodes({
dataAreaId: "RUMF",
tnVedCode: "8471300000",
name: "Portable automatic data processing machines",
description: "Laptops and portable computers under 10 kg",
blocked: "No"
});
getTNVEDCodes
Reads a specific TNVED code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
tnVedCode | string | Yes | The TNVED code key field. |
headers | map<string|string[]> | No | Additional HTTP request headers. |
queries | GetTNVEDCodesQueries | No | OData query parameters: $expand, $select. |
Returns: trade:TNVEDCode|error
Sample code:
trade:TNVEDCode code = check fo->getTNVEDCodes("RUMF", "8471300000");
deleteTNVEDCodes
Deletes a specific TNVED code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
tnVedCode | string | Yes | The TNVED code key field. |
headers | DeleteTNVEDCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: error?
Sample code:
check fo->deleteTNVEDCodes("RUMF", "8471300000", headers = {ifMatch: eTag});
updateTNVEDCodes
Updates a specific TNVED code.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
dataAreaId | string | Yes | The company data area identifier. |
tnVedCode | string | Yes | The TNVED code key field. |
payload | TNVEDCode | Yes | Fields to update. |
headers | UpdateTNVEDCodesHeaders | No | Additional HTTP request headers; set ifMatch to the entity's current ETag for optimistic concurrency. |
Returns: trade:TNVEDCode|error
Sample code:
trade:TNVEDCode updated = check fo->updateTNVEDCodes(
"RUMF",
"8471300000",
{blocked: "Yes"},
headers = {ifMatch: eTag}
);