web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Why does BC include this blank record in the API response when it's not saved to the database?

(6) ShareShare
ReportReport
Posted on by 23
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)


  •  

The extra record has serviceItemLineNo = 0 and other zero/empty values.

I have the same question (0)
  • Tom_Gioielli Profile Picture
    3,084 Super User 2026 Season 1 on at
    Moved post to BC forums.
  • Suggested answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at
    That's a bit strange. Do you try the standard APIs and see if they have this problem? For example, the salesOrderLines API.
    If the standard is correct, please redesign your API according to the standard practices.
     
    PS: Deep insert with Business Central APIs
     
    Thanks.
    ZHU
     
  • Chhay Profile Picture
    23 on at

    For the Sales API, I duplicated the standard Sales Order and Sales Order Line. It works as expected and uses temporary tables. Both API pages have PageType = API. I needed to expand one more child (for example, Reservation Entry) and it works for Sales. According to the documentation you provided, the line page uses PageType = ListPart, which cannot expand additional children — is that correct?

     

    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.

  • Suggested answer
    OussamaSabbouh Profile Picture
    12,803 Super User 2026 Season 1 on at
    Hello,
     
    The extra blank record you see in the deep-insert response isn’t a real database record.
    It’s just the API framework returning the UI “new line” placeholder (Line No. = 0) along with your actual child records.
    BC always keeps one blank buffer row ready when API pages contain child entities.
    Deep insert serializes that blank row into the response, even though it never gets written to the table.
    So the behavior is normal.
    Just ignore rows where the key/line number = 0, or filter them out in the API page if you want a cleaner response.
     
    Regards,
    Oussama Sabbouh
  • Chhay2 Profile Picture
    11 on at

    I've tried filtering the blank record using SourceTableView, OnInsertRecord trigger, and others trigger in API page, but the blank row still appears in the POST response (though it works fine for GET requests).

    Is there any way to exclude this blank buffer row from the deep-insert API response at the page level, or is client-side filtering the only option?
    Thanks,
    Chhay
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans