Skip to main content

Posts

Showing posts from December, 2025

How to Create a Custom Data Entity in Dynamics 365 Finance and Operations

  Creating a Data Entity in Dynamics 365 Finance and Operations (D365FO) is essential for enabling data import/export, integrations, and public APIs. In this blog, we’ll walk through both the basic shortcut method and the advanced method for creating a custom Data Entity, using a table named MZNFRCustomTable as our example. 🧩 Step 1: Create a Custom Table Start by creating a new table in your project. Go to Solution Explorer → Right-click your project → Add New Item Select Table under FinanceOperations > Data Model Name it MZNFRCustomTable 🧱 Step 2: Add Fields to Your Table Define the fields you need in your table. For example: CustomerAccount CustomerName Currency PaymentNote Balance  Step 3: Shortcut Method – Create Data Entity via Addins Right-click on your table → Addins → Create Data Entity This method is quick but limited in customization. ❗ Common Error If you haven’t created an index, you’ll get this error: "The natural key for the table MZNFRCusto...

Consuming an External REST API in Dynamics 365 Finance & Operations (X++) and Saving Data into a Custom Table

  Introduction In this blog, I will explain how I consumed an online REST API in Microsoft Dynamics 365 Finance & Operations (D365 FO) using X++ and CLR Interop , deserialized the JSON response using Data Contract classes , and finally stored the data in a custom table . This is a common real-world integration scenario where external systems expose data via REST APIs and D365 FO needs to consume and persist that data. For this demo, I used the following public REST API : API URL: https://api.restful-api.dev/objects Solution Overview The solution consists of four X++ classes : MZNFRConsumeRestAPI – Main logic class (API call, deserialization, DB insert) MZNFRConsumeRestAPIParentContract – Parent contract (wraps JSON list) MZNFRConsumeRestAPIHeaderContract – Header contract (id, name) MZNFRConsumeRestAPILinesContract – Child contract (nested data node) 📌 Class Structure Diagram API Response Structure The API returns a JSON array like this: [ { ...

D365 FO Customer Details Web Service Using X++ Integration API

  Dynamics 365 FO – Fetch Customer Details Integration API (With Full X++ Code + JSON Explanation) In this article, I am sharing the complete implementation of my Customer Details Integration API in Microsoft Dynamics 365 Finance & Operations (D365 FO). This API is designed to: ✔ Fetch a specific customer when CustAccount is provided in the JSON ✔ Fetch all customers when CustAccount is NOT provided ✔ Return multiple addresses and multiple contacts for each customer ✔ Return financial dimensions (BusinessUnit, CostCenter, Department, Project) ⭐ How the API Works 1. When CustAccount is provided If the JSON contains: { "DataAreaId": "USMF", "CustAccount": "1101" } ➡ The API returns only that specific customer's details, including their addresses, contacts, and dimensions. 2. When CustAccount is NOT provided If JSON is: { "DataAreaId": "USMF" } ➡ The API returns all customers f...