Why does BC include this blank record in the API response when it's not saved to the database?
I created custom API pages for Service Management in Business Central (Service Order, Service Item Line, Service Order Line) using standard BC tables.
The Problem
When I do a deep insert (POST with nested child records), the API response includes an extra blank child record that doesn't exist in the database.
Pattern:
- Insert 1 Service Order Line → Response shows 2 (only 1 in database)
- Insert 2 Service Order Lines → Response shows 3 (only 2 in database)
Details:
For the Service API, I linked Service Order to Service Item Line using Document No. and Document Type, and linked Service Item Line to Service Order Line using Document No., Document Type, and Line No. All these pages use PageType = API. Because I need to expand additional children for Service Order Line (for example, Reservation Entry and DimensionSetLine), I used this query:
baseUrl/serviceOrders?$expand=serviceItemLines($expand=serviceOrderLines)
The data returned for serviceOrder and serviceItemLines is correct, but the data in serviceOrderLines is incorrect, as I mentioned above.
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions