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:
CustomerAccountCustomerNameCurrencyPaymentNoteBalance
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 MZNFRCustomTable was not found."
🔧 Step 3.1: Fix – Create an Index
To resolve the error:
- Right-click Indexes → Add a new index (e.g.,
CustomerAccountIdx) - Add the
CustomerAccountfield - Set:
Allow Duplicates = NoAlternate Key = Yes
✅ Step 3.2: Retry Add-ins Method
Once the index is configured, retry the Add-ins shortcut to create the Data Entity.
🧠 Step 4: Advanced Method – Full Control Over Data Entity
For better flexibility and control, use the advanced method.
- Go to Solution Explorer → Right-click your project → Add New Item
- Select Data Entity under FinanceOperations > Data Model
- Name it
MZNFRCustomTableEntity
🔗 Step 5: Specify Primary Datasource
In the wizard:
- Set Primary Datasource to
MZNFRCustomTable - Choose Entity Category (e.g., Master)
- Enable:
- Public API (optional)
- Data Management capabilities
📋 Step 6: Select Fields
Choose which fields to include in your Data Entity.
✅ Step 7: Set Mandatory Fields
Use the IsMandatory checkbox to mark required fields.
🎉 Step 8: Finish and Verify
Click Next to complete the wizard. Open your Data Entity object and verify:
- All selected fields are present
- Mappings and metadata are correct
🔄 Step 9: Regenerate Staging Table (Important!)
If you make changes to your table or Data Entity later:
- Right-click the Data Entity → Regenerate staging table
This ensures your changes are reflected in data import/export operations.
🏁 Conclusion
Creating a Data Entity in D365FO can be done quickly via Add-ins or more robustly through the advanced method. Always ensure your table has a proper index and remember to regenerate the staging table after changes.
This guide should help you streamline your development workflow and avoid common pitfalls. Happy coding!



