Example
What you'll build
This example builds an automation that connects to Microsoft Dynamics 365 Finance System Config and lists the reason codes configured in the environment. The flow authenticates with Microsoft Entra ID using the OAuth2 client credentials grant, retrieves the reason records, and logs the result as JSON.
Operations used:
- List Reasons : Reads all
Reasonsrecords — the general-purpose reason codes used for write-offs, adjustments, and other transactions — from the connected environment.
Architecture
Prerequisites
-
A Microsoft Entra ID application registered with access to a Microsoft Dynamics 365 Finance and Operations environment, along with its client ID, client secret, and OAuth2 token URL.
-
The application must be registered as a user in the target Dynamics 365 Finance and Operations environment and assigned the security roles required for this connector's operations.
Setting up the Microsoft Dynamics 365 Finance System Config integration
New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the connector.
Adding the Microsoft Dynamics 365 Finance System Config connector
Step 1: Open the connector palette
Select Add Connection in the Connections section.
Step 2: Select the Microsoft Dynamics 365 Finance System Config connector
- Enter
microsoft.dynamics365.finance.sysconfigin the search field. - Select the Sysconfig connector card.
Configuring the Microsoft Dynamics 365 Finance System Config connection
Step 3: Bind the connection parameters to configurable variables
- Select the Config field to open the Record Configuration panel.
- Select the auth checkbox to include the OAuth2 client credentials fields; the required
clientIdandclientSecretfields are included automatically. - Select the optional tokenUrl field as well, since the client credentials grant needs it.
- Close the Record Configuration panel, then create three string configurable variables named
tokenUrl,clientId, andclientSecretunder Configurations. - Return to Add Connection, search for the connector again, and switch the Config field from Record to Expression mode.
- Enter
{auth: {tokenUrl, clientId, clientSecret, scopes}}as the expression, referencing the three configurable variables. - Open the helper panel for the Service Url field, select the Configurables tab, and create a string configurable named
serviceUrl; it's inserted into the field automatically.
- Config : The OAuth2 client credentials configuration used to authenticate the connection.
- Service Url : URL of the target Microsoft Dynamics 365 Finance and Operations environment. Use the OData root, for example
https://<your-org>.operations.dynamics.com/data.
Step 4: Save the connection
Select Save Connection and verify that sysconfigClient appears in the Connections section.
Step 5: Set actual values for your configurables
- Select Configurations at the bottom of the project tree under Data Mappers.
- Enter a value for each configurable listed below before you run the integration.
- tokenUrl (
string) : The OAuth2 token endpoint URL for the Microsoft Entra ID application. - clientId (
string) : The client ID of the registered Microsoft Entra ID application. - clientSecret (
string) : The client secret of the registered Microsoft Entra ID application. - scopes (
string[]) : The OAuth2 scope requested for the client-credentials token, set to the environment base URL followed by/.default - serviceUrl (
string) : URL of the target Microsoft Dynamics 365 Finance and Operations environment.
Configuring the Microsoft Dynamics 365 Finance System Config List Reasons operation
Step 6: Add an automation entry point
- Select Add Entry Point next to Entry Points.
- Select Automation.
- Select Create to accept the settings.
Step 7: Expand the connection and configure the List Reasons operation
- Select the add icon on the automation flow.
- Expand sysconfigClient to display its operations.
- Select List Reasons. This operation has no required parameters, so the default result variable name,
sysconfigReasonscollection, is sufficient.
- Select Save.
Step 8: Log the List Reasons result
- Select the add icon on the link between the List Reasons node and Error Handler.
- Expand Logging and select Log Info.
- Switch the Msg field to Expression mode and enter
sysconfigReasonscollection.toJsonString(). - Select Save.
Try it yourself
Try this sample in WSO2 Integration Platform.
More code examples
The Dynamics 365 Finance Ballerina connectors provide practical examples illustrating usage in various scenarios. Explore these examples.





