microsoft.dynamics365.finance.procurement
Module microsoft.dynamics365.finance.procurement
API
Definitions
ballerinax/microsoft.dynamics365.finance.procurement Ballerina library
Overview
Microsoft Dynamics 365 Finance is Microsoft's cloud ERP solution for financial management, covering general ledger, accounts receivable and payable, fixed assets, budgeting, cash and bank management, and tax.
The microsoft.dynamics365.finance.procurement connector provides access to Microsoft Dynamics 365 Finance Procurement entities via the OData REST API.
Key Features
- Manage procurement entities in Microsoft Dynamics 365 Finance
- Support for list, create, read, update, and delete operations
- OAuth2 client credentials authentication
Setup guide
Prerequisites
- A Microsoft Dynamics 365 Finance & Operations environment (cloud-hosted or sandbox)
- An Azure Active Directory (Entra ID) app registration with API permissions for Dynamics 365
Step 1: Register an application in Azure AD
-
Sign in to the Azure portal and navigate to Azure Active Directory → App registrations → New registration.
-
Give the application a name, select the appropriate account type, and click Register.
-
Note the Application (client) ID and Directory (tenant) ID from the overview page.
-
Under Certificates & secrets, create a new client secret and note the value immediately — it is only shown once.
Step 2: Grant Dynamics 365 API permissions
-
In the app registration, go to API permissions → Add a permission → APIs my organization uses.
-
Search for Dynamics 365 (or
Microsoft Dynamics ERP) and add theuser_impersonation(or.default) delegated/application scope. -
Click Grant admin consent for your tenant.
Step 3: Add the app as a D365 user
-
In your D365 Finance environment, go to System administration → Users → New.
-
Set the User ID and User name, then paste the Azure AD Application (client) ID into the Azure AD application field.
-
Assign appropriate security roles and save.
Quickstart
To use the microsoft.dynamics365.finance.procurement connector in your Ballerina application, modify the .bal file as follows:
Step 1: Import the module
import ballerinax/microsoft.dynamics365.finance.procurement;
Step 2: Instantiate a new connector
configurable string tenantId = ?; configurable string clientId = ?; configurable string clientSecret = ?; configurable string serviceUrl = ?; // e.g. "https://<env>.operations.dynamics.com/data" procurement:Client cl = check new ({ config = { auth: { tokenUrl: string `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`, clientId, clientSecret, scopes: [string `${serviceUrl}/.default`] } }, serviceUrl );
Step 3: Invoke the connector operation
procurement:DeliveryTermsCollection results = check cl->listDeliveryTerms();
Step 4: Run the Ballerina application
bal run
Examples
The Dynamics 365 Finance Ballerina connectors provide practical examples illustrating usage in various scenarios. Explore these examples.
Clients
microsoft.dynamics365.finance.procurement: Client
Constructor
Gets invoked to initialize the connector.
init (ConnectionConfig config, string serviceUrl)- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://your-org.operations.dynamics.com/data" - URL of the target service
listDeliveryTerms
function listDeliveryTerms(map<string|string[]> headers, *ListDeliveryTermsQueries queries) returns DeliveryTermsCollection|errorList DeliveryTerms
Parameters
- queries *ListDeliveryTermsQueries - Queries to be sent with the request
Return Type
- DeliveryTermsCollection|error - Collection of DeliveryTerm
createDeliveryTerms
function createDeliveryTerms(DeliveryTerm payload, map<string|string[]> headers) returns DeliveryTerm|errorCreate DeliveryTerm
Parameters
- payload DeliveryTerm - The request body
Return Type
- DeliveryTerm|error - DeliveryTerm created
getDeliveryTerms
function getDeliveryTerms(string dataAreaId, string termsCode, map<string|string[]> headers, *GetDeliveryTermsQueries queries) returns DeliveryTerm|errorGet DeliveryTerm by key
Parameters
- dataAreaId string - The company data area identifier
- termsCode string - The terms code key field
- queries *GetDeliveryTermsQueries - Queries to be sent with the request
Return Type
- DeliveryTerm|error - DeliveryTerm
deleteDeliveryTerms
function deleteDeliveryTerms(string dataAreaId, string termsCode, DeleteDeliveryTermsHeaders headers) returns error?Delete DeliveryTerm
Parameters
- dataAreaId string - The company data area identifier
- termsCode string - The terms code key field
- headers DeleteDeliveryTermsHeaders (default {}) - Headers to be sent with the request
Return Type
- error? - DeliveryTerm deleted
updateDeliveryTerms
function updateDeliveryTerms(string dataAreaId, string termsCode, DeliveryTerm payload, UpdateDeliveryTermsHeaders headers) returns DeliveryTerm|errorUpdate DeliveryTerm
Parameters
- dataAreaId string - The company data area identifier
- termsCode string - The terms code key field
- payload DeliveryTerm - The request body
- headers UpdateDeliveryTermsHeaders (default {}) - Headers to be sent with the request
Return Type
- DeliveryTerm|error - DeliveryTerm updated
listDiscountRates
function listDiscountRates(map<string|string[]> headers, *ListDiscountRatesQueries queries) returns DiscountRatesCollection|errorList DiscountRates
Parameters
- queries *ListDiscountRatesQueries - Queries to be sent with the request
Return Type
- DiscountRatesCollection|error - Collection of DiscountRate
createDiscountRates
function createDiscountRates(DiscountRate payload, map<string|string[]> headers) returns DiscountRate|errorCreate DiscountRate
Parameters
- payload DiscountRate - The request body
Return Type
- DiscountRate|error - DiscountRate created
getDiscountRates
function getDiscountRates(string dataAreaId, string startDate, map<string|string[]> headers, *GetDiscountRatesQueries queries) returns DiscountRate|errorGet DiscountRate by key
Parameters
- dataAreaId string - The company data area identifier
- startDate string - The start date key field
- queries *GetDiscountRatesQueries - Queries to be sent with the request
Return Type
- DiscountRate|error - DiscountRate
deleteDiscountRates
function deleteDiscountRates(string dataAreaId, string startDate, DeleteDiscountRatesHeaders headers) returns error?Delete DiscountRate
Parameters
- dataAreaId string - The company data area identifier
- startDate string - The start date key field
- headers DeleteDiscountRatesHeaders (default {}) - Headers to be sent with the request
Return Type
- error? - DiscountRate deleted
updateDiscountRates
function updateDiscountRates(string dataAreaId, string startDate, DiscountRate payload, UpdateDiscountRatesHeaders headers) returns DiscountRate|errorUpdate DiscountRate
Parameters
- dataAreaId string - The company data area identifier
- startDate string - The start date key field
- payload DiscountRate - The request body
- headers UpdateDiscountRatesHeaders (default {}) - Headers to be sent with the request
Return Type
- DiscountRate|error - DiscountRate updated
listIntentLetters
function listIntentLetters(map<string|string[]> headers, *ListIntentLettersQueries queries) returns IntentLettersCollection|errorList IntentLetters
Parameters
- queries *ListIntentLettersQueries - Queries to be sent with the request
Return Type
- IntentLettersCollection|error - Collection of IntentLetter
createIntentLetters
function createIntentLetters(IntentLetter payload, map<string|string[]> headers) returns IntentLetter|errorCreate IntentLetter
Parameters
- payload IntentLetter - The request body
Return Type
- IntentLetter|error - IntentLetter created
getIntentLetters
function getIntentLetters(string dataAreaId, string intentLetterId, map<string|string[]> headers, *GetIntentLettersQueries queries) returns IntentLetter|errorGet IntentLetter by key
Parameters
- dataAreaId string - The company data area identifier
- intentLetterId string - The intent letter id key field
- queries *GetIntentLettersQueries - Queries to be sent with the request
Return Type
- IntentLetter|error - IntentLetter
deleteIntentLetters
function deleteIntentLetters(string dataAreaId, string intentLetterId, DeleteIntentLettersHeaders headers) returns error?Delete IntentLetter
Parameters
- dataAreaId string - The company data area identifier
- intentLetterId string - The intent letter id key field
- headers DeleteIntentLettersHeaders (default {}) - Headers to be sent with the request
Return Type
- error? - IntentLetter deleted
updateIntentLetters
function updateIntentLetters(string dataAreaId, string intentLetterId, IntentLetter payload, UpdateIntentLettersHeaders headers) returns IntentLetter|errorUpdate IntentLetter
Parameters
- dataAreaId string - The company data area identifier
- intentLetterId string - The intent letter id key field
- payload IntentLetter - The request body
- headers UpdateIntentLettersHeaders (default {}) - Headers to be sent with the request
Return Type
- IntentLetter|error - IntentLetter updated
listVendorInvoiceDeclarations
function listVendorInvoiceDeclarations(map<string|string[]> headers, *ListVendorInvoiceDeclarationsQueries queries) returns VendorInvoiceDeclarationsCollection|errorList VendorInvoiceDeclarations
Parameters
- queries *ListVendorInvoiceDeclarationsQueries - Queries to be sent with the request
Return Type
- VendorInvoiceDeclarationsCollection|error - Collection of VendorInvoiceDeclaration
createVendorInvoiceDeclarations
function createVendorInvoiceDeclarations(VendorInvoiceDeclaration payload, map<string|string[]> headers) returns VendorInvoiceDeclaration|errorCreate VendorInvoiceDeclaration
Parameters
- payload VendorInvoiceDeclaration - The request body
Return Type
- VendorInvoiceDeclaration|error - VendorInvoiceDeclaration created
getVendorInvoiceDeclarations
function getVendorInvoiceDeclarations(string dataAreaId, string invoiceDeclarationId, map<string|string[]> headers, *GetVendorInvoiceDeclarationsQueries queries) returns VendorInvoiceDeclaration|errorGet VendorInvoiceDeclaration by key
Parameters
- dataAreaId string - The company data area identifier
- invoiceDeclarationId string - The invoice declaration id key field
- queries *GetVendorInvoiceDeclarationsQueries - Queries to be sent with the request
Return Type
- VendorInvoiceDeclaration|error - VendorInvoiceDeclaration
deleteVendorInvoiceDeclarations
function deleteVendorInvoiceDeclarations(string dataAreaId, string invoiceDeclarationId, DeleteVendorInvoiceDeclarationsHeaders headers) returns error?Delete VendorInvoiceDeclaration
Parameters
- dataAreaId string - The company data area identifier
- invoiceDeclarationId string - The invoice declaration id key field
- headers DeleteVendorInvoiceDeclarationsHeaders (default {}) - Headers to be sent with the request
Return Type
- error? - VendorInvoiceDeclaration deleted
updateVendorInvoiceDeclarations
function updateVendorInvoiceDeclarations(string dataAreaId, string invoiceDeclarationId, VendorInvoiceDeclaration payload, UpdateVendorInvoiceDeclarationsHeaders headers) returns VendorInvoiceDeclaration|errorUpdate VendorInvoiceDeclaration
Parameters
- dataAreaId string - The company data area identifier
- invoiceDeclarationId string - The invoice declaration id key field
- payload VendorInvoiceDeclaration - The request body
- headers UpdateVendorInvoiceDeclarationsHeaders (default {}) - Headers to be sent with the request
Return Type
- VendorInvoiceDeclaration|error - VendorInvoiceDeclaration updated
Records
microsoft.dynamics365.finance.procurement: ConnectionConfig
Fields
- auth OAuth2ClientCredentialsGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
microsoft.dynamics365.finance.procurement: DeleteDeliveryTermsHeaders
Represents the Headers record for the operation: deleteDeliveryTerms
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: DeleteDiscountRatesHeaders
Represents the Headers record for the operation: deleteDiscountRates
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: DeleteIntentLettersHeaders
Represents the Headers record for the operation: deleteIntentLetters
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: DeleteVendorInvoiceDeclarationsHeaders
Represents the Headers record for the operation: deleteVendorInvoiceDeclarations
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: DeliveryTerm
Fields
- isCashOnDelivery? NoYes -
- doRetailSalesOrdersGetTransportationChargesAdded? NoYes -
- inventoryProfile? string -
- portMandatory? NoYes -
- intrastatCode? string -
- freightChargeTerms? WMSFreightChargeTerms -
- salesTaxLocationRole? LogisticsLocationRoleType -
- dataAreaId? string -
- termsCode? string -
- termsDescription? string -
- receiptTransactionStatus? CustomInventTransStatusRU -
- goodsInTransitControl? NoYes -
- willShipmentConfirmationTransferCharges? NoYes -
microsoft.dynamics365.finance.procurement: DeliveryTermsCollection
Fields
- Fields Included from *ODataCollection
- Fields Included from *DeliveryTermsCollectionAllOf2
- value DeliveryTerm[]
- anydata...
microsoft.dynamics365.finance.procurement: DeliveryTermsCollectionAllOf2
Fields
- value? DeliveryTerm[] -
microsoft.dynamics365.finance.procurement: DiscountRate
Fields
- startDate? string -
- dataAreaId? string -
- marketDiscountRatePercentage? decimal -
microsoft.dynamics365.finance.procurement: DiscountRatesCollection
Fields
- Fields Included from *ODataCollection
- Fields Included from *DiscountRatesCollectionAllOf2
- value DiscountRate[]
- anydata...
microsoft.dynamics365.finance.procurement: DiscountRatesCollectionAllOf2
Fields
- value? DiscountRate[] -
microsoft.dynamics365.finance.procurement: GetDeliveryTermsQueries
Represents the Queries record for the operation: getDeliveryTerms
Fields
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: GetDiscountRatesQueries
Represents the Queries record for the operation: getDiscountRates
Fields
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: GetIntentLettersQueries
Represents the Queries record for the operation: getIntentLetters
Fields
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: GetVendorInvoiceDeclarationsQueries
Represents the Queries record for the operation: getVendorInvoiceDeclarations
Fields
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: IntentLetter
Fields
- status? IntentLetterStatusIT -
- intentLetterNotes? string -
- intentLetterAmountMST? decimal -
- purchaseType? IntentLetterPurchaseTypeIT -
- vendName? string -
- intentLetterYear? Signed32 -
- reportId? string -
- intentLetterType? IntentLetterTypeIT -
- dataAreaId? string -
- intentLetterId? string -
- closingNotes? string -
- toDate? string -
- fromDate? string -
- closedDate? string -
- protocol? string -
- intentLetterDate? string -
- vendAccount? string -
microsoft.dynamics365.finance.procurement: IntentLettersCollection
Fields
- Fields Included from *ODataCollection
- Fields Included from *IntentLettersCollectionAllOf2
- value IntentLetter[]
- anydata...
microsoft.dynamics365.finance.procurement: IntentLettersCollectionAllOf2
Fields
- value? IntentLetter[] -
microsoft.dynamics365.finance.procurement: ListDeliveryTermsQueries
Represents the Queries record for the operation: listDeliveryTerms
Fields
- skip? int - OData $skip query parameter - number of records to skip
- top? int - OData $top query parameter - maximum number of records to return
- filter? string - OData $filter query parameter - filter expression
- orderby? string - OData $orderby query parameter - sort order expression
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- crossCompany? boolean - When true, query results include records from all companies
- count? boolean - When true, the response includes the total count of matching records
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: ListDiscountRatesQueries
Represents the Queries record for the operation: listDiscountRates
Fields
- skip? int - OData $skip query parameter - number of records to skip
- top? int - OData $top query parameter - maximum number of records to return
- filter? string - OData $filter query parameter - filter expression
- orderby? string - OData $orderby query parameter - sort order expression
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- crossCompany? boolean - When true, query results include records from all companies
- count? boolean - When true, the response includes the total count of matching records
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: ListIntentLettersQueries
Represents the Queries record for the operation: listIntentLetters
Fields
- skip? int - OData $skip query parameter - number of records to skip
- top? int - OData $top query parameter - maximum number of records to return
- filter? string - OData $filter query parameter - filter expression
- orderby? string - OData $orderby query parameter - sort order expression
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- crossCompany? boolean - When true, query results include records from all companies
- count? boolean - When true, the response includes the total count of matching records
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: ListVendorInvoiceDeclarationsQueries
Represents the Queries record for the operation: listVendorInvoiceDeclarations
Fields
- skip? int - OData $skip query parameter - number of records to skip
- top? int - OData $top query parameter - maximum number of records to return
- filter? string - OData $filter query parameter - filter expression
- orderby? string - OData $orderby query parameter - sort order expression
- expand? string - OData $expand query parameter - comma-separated list of related entities to include
- crossCompany? boolean - When true, query results include records from all companies
- count? boolean - When true, the response includes the total count of matching records
- 'select? string - OData $select query parameter - comma-separated list of fields to return
microsoft.dynamics365.finance.procurement: OAuth2ClientCredentialsGrantConfig
OAuth2 Client Credentials Grant Configs
Fields
- Fields Included from *OAuth2ClientCredentialsGrantConfig
- tokenUrl string(default "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token") - Token URL
microsoft.dynamics365.finance.procurement: ODataCollection
Fields
- odataNextLink? string -
- odataCount? int -
- odataContext? string -
microsoft.dynamics365.finance.procurement: UpdateDeliveryTermsHeaders
Represents the Headers record for the operation: updateDeliveryTerms
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: UpdateDiscountRatesHeaders
Represents the Headers record for the operation: updateDiscountRates
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: UpdateIntentLettersHeaders
Represents the Headers record for the operation: updateIntentLetters
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: UpdateVendorInvoiceDeclarationsHeaders
Represents the Headers record for the operation: updateVendorInvoiceDeclarations
Fields
- ifMatch? string - ETag value for optimistic concurrency; prevents overwriting concurrent modifications
microsoft.dynamics365.finance.procurement: VendorInvoiceDeclaration
Fields
- dataAreaId? string -
- description? string -
- recordType? InvoiceRecordTypeIS -
- invoiceDeclarationId? string -
- reportingCode? string -
microsoft.dynamics365.finance.procurement: VendorInvoiceDeclarationsCollection
Fields
- Fields Included from *ODataCollection
- Fields Included from *VendorInvoiceDeclarationsCollectionAllOf2
- value VendorInvoiceDeclaration[]
- anydata...
microsoft.dynamics365.finance.procurement: VendorInvoiceDeclarationsCollectionAllOf2
Fields
- value? VendorInvoiceDeclaration[] -
Union types
microsoft.dynamics365.finance.procurement: InvoiceRecordTypeIS
InvoiceRecordTypeIS
microsoft.dynamics365.finance.procurement: LogisticsLocationRoleType
LogisticsLocationRoleType
microsoft.dynamics365.finance.procurement: NoYes
NoYes
microsoft.dynamics365.finance.procurement: WMSFreightChargeTerms
WMSFreightChargeTerms
microsoft.dynamics365.finance.procurement: CustomInventTransStatusRU
CustomInventTransStatusRU
microsoft.dynamics365.finance.procurement: IntentLetterTypeIT
IntentLetterTypeIT
microsoft.dynamics365.finance.procurement: IntentLetterStatusIT
IntentLetterStatusIT
microsoft.dynamics365.finance.procurement: IntentLetterPurchaseTypeIT
IntentLetterPurchaseTypeIT
Import
import ballerinax/microsoft.dynamics365.finance.procurement;Other versions
0.8.0
Metadata
Released date: 2 days ago
Version: 0.8.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.13.0
GraalVM compatible: Yes
Pull count
Total: 0
Current verison: 0
Weekly downloads
Keywords
Name/Microsoft Dynamics 365 Finance Procurement
Area/Accounts Payable
Vendor/Microsoft
Dynamics365
Finance
ERP
Type/Connector
Procurement
Vendor
PurchaseOrder
Delivery
Contributors