Integration with Finance and Operations – From Basics (Part 1)

Introduction

Finance and Operations provides two major ways to interact with tables (or data entities) for external system using APIs; namely Custom Services and Data Entities.

Data entities in D365 Finance and Operations simplify data management by grouping data from multiple tables. They make it easier to import, export, and integrate data with other systems. Custom services in D365 Finance and Operations allow developers to create web services for specific business needs.
They enable external systems to interact with D365 F&O by exposing custom logic and operations.
This helps in integrating and automating processes with other applications.

FeatureData EntitiesCustom Services
Purpose Simplify data management tasks like import, export, and integration. Expose custom business logic and operations as web services.
Functionality Provide structured access to data from multiple tables in a unified format. Allow external systems to perform actions or retrieve data via API calls.
Usage Used for bulk data operations, data migration, and integration with external systems. Used for real-time integration, extending functionality, and custom business process automation.
Typical Use Cases Data import/export, data synchronization, and data migration. Integrating with external applications, custom business processes, and real-time data access.
Data Handling Focuses on data in bulk. Focuses on specific operations or business logic.

Pre-requisites

  • A Finance and Operations Environment
  • Postman connected to FnO Enviroment (If you want to do this follow the blog here)

References

Data Entities Overview – Finance and Operations

Build and consume data entities – Finance and Operations

Exposing an X++ class as a Data Contract

Configuration

Here, to understand creation of APIs in either case, we’ll expose the same table using both Data Entities and Custom Services.

Data Entity:

Right click on the project and click on “Add” and then “New Item”

Click on Finance and Operations > Dynamic 365 Items > Data Model and then select “Data Entity”

Select the table that you want to expose in the “Primary Data Source” field, appropirate “Entity Category”, “Public Entity Name” and “Public Entity Set Name” (which is what the endpoint will be), and the Staging Table name.


Select the necessary fields from the primary data source.

You can add related tables by clicking on the small arrow next to the table name, which displays the list of all associated tables.

Then you can select the relevant fields from the associated tables.

Once done, you’ll get one data entity, two security privileges and one staging table created.

If you want to add new data sources, then you can right click on the Primary Data Source’s “Data Sources” tab and add new data source.

You can drag fields from any of the data sources into the “Fields” section of the data entity to make them available on the API.

Calling the Data Entity
You can call <base url>/data url to get a list of all the data entities available in the system.

From here, if I call a “GET” request on my Data Entity (the “Public Collection Name” property of the data entity, which we set in the Data Entity wizard), I’ll get the following response.Please note that this “Public Collection Name” is case sensitive.

Now, if I need to create a “Customer” record then I can simply pass the same keys into a “POST” request.

And we can see the same in FnO.

If we want to update a record, then we make the PUT request with the syntax – 

{{base_url}}/data/TestCustomers(dataAreaId='<Company Name>’,CustomerId='<Customer Id>’)

It will include all the Entity Keys defined on the Data Entity as we only have one field then we are simply passing that.

Passing it without the DataAreaId will throw errors.

You can delete the record using the same syntax but with the “Delete” request.

Conclusion:

In this blog, we explored how to create APIs using Data Entities in Dynamics 365 Finance and Operations, simplifying data management and external system integrations. Data Entities offer an efficient way to handle bulk data operations, while Custom Services provide flexibility for exposing specific business logic

We’ll see how to create APIs using Custom Services in the next blog.

We hope you found this article useful, and if you would like to discuss anything, you can reach out to us at [email protected]


Share Story :

Secured By miniOrange