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

Problem for custom Deep Insert for line entity

(0) ShareShare
ReportReport
Posted on by 140

Hi Experts,

We add some UDFs in the sales order header and sales order lines, so I create two pages for deep insert to use one post to create sales order.

Now we use API to get sales order successfully, and when use API to create sales order without line, it works. But when I add sales order lines in the request body, it return "error": {

       "code": "Internal_RecordNotFound",

       "message": "The Sales Header does not exist. Identification fields and values: Document Type='Quote',No.='EDI1006'  CorrelationId:  59ed2b89-e61c-4009-ac73-ad241b42c208."

   }

Below is the pages and request body for you reference? Could you please shed me some lights on it?

page 70203543 TRCSalesOrder

{

   APIVersion = 'v1.0';

   Caption = 'salesOrders', Locked = true;

   ChangeTrackingAllowed = true;

   DelayedInsert = true;

   EntityName = 'salesOrder';

   EntitySetName = 'salesOrders';

   ODataKeyFields = "No.";

   PageType = API;

   APIPublisher = 'XXXX';

   APIGroup = 'XXX';

   SourceTable = "Sales Header";

   Extensible = false;

   layout

   {

       area(content)

       {

           repeater(Group)

           {

               field(id; Id)

               {

                   ApplicationArea = All;

               }

               field("documentType"; "Document Type")

               {

                   ApplicationArea = All;

               }

               field("number"; "No.")

               {

                   ApplicationArea = All;

               }

               field("orderDate"; "Order Date")

               { ApplicationArea = All; }

               field("postingDate"; "Posting Date")

               { ApplicationArea = All; }

               field("shipmentDate"; "Shipment Date")

                                  .

                                  .

                                  .

               part(salesOrderLines; 70203542)

               {

                   ApplicationArea = All;

                   Caption = 'Lines', Locked = true;

                   EntityName = 'salesOrderLine';

                   EntitySetName = 'salesOrderLines';

                   SubPageLink = "Document No." = FIELD("No.");

               }

           }

       }

   }

   trigger OnInsertRecord(BelowxRec: Boolean): Boolean

   begin

       Insert(true);

       exit(false);

   end;

   trigger OnDeleteRecord(): Boolean

   begin

       Delete(true);

   end;

}

page 70203542 TRCSalesOrderLines

{

   Caption = 'SalesLines';

   PageType = ListPart;

   DelayedInsert = true;

   SourceTable = "Sales Line";

   layout

   {

       area(Content)

       {

           repeater(General)

           {

               field("documentType"; "Document Type")

               {

                   ApplicationArea = All;

               }

               field("documentNumber"; "Document No.")

               {

                   ApplicationArea = All;

               }

               field("lineNumber"; "Line No.")

               {

                   ApplicationArea = All;

               }

               field("number"; "No.")

               {

                   ApplicationArea = All;

               }

               field("quantity"; Quantity)

               {

                   ApplicationArea = All;

               }

               field("unitPrice"; "Unit Price")

               {

                   ApplicationArea = All;

               }

       }

   }

   trigger OnInsertRecord(BelowxRec: Boolean): Boolean

   begin

       Insert(true);

       exit(false);

   end;

   trigger OnDeleteRecord(): Boolean

   begin

       Delete(true);

   end;

}

Request Body

{  

   "number": "EDI1006",

   "sellToCustomerNumber": "10000",

   "documentType": "Order",

   "orderDate": "2020-08-10",

   "postingDate": "2020-08-10",

   "shipmentDate": "2020-08-10",

   "salesOrderLines": [

       {

           "number": "1896-S",

           "quantity": 2,

           "unitPrice": 2

    },

    {

           "number": "1900-S",

           "quantity": 2,

           "unitPrice": 2

    }

   ]

}

  • Suggested answer
    Dan Kinsella Profile Picture
    468 on at

    This should help: www.kauffmann.nl/.../

  • Khadija Profile Picture
    27 on at

    Hi Denny,

    I have the same problem, if you solve it, could you share the solution with us

    best regard

  • Suggested answer
    DAnny3211 Profile Picture
    11,427 Super User 2026 Season 1 on at

    ciao

    nel SubPageLink = "Document No." = FIELD("No."); aggiungici anche il tipo di documento

    controlla la mia risposta se ti è stata utile, grazie

    DAniele

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 765 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 571 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 299 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans