When creating a transaction in Dynamics 365 Business Central with a header and line relationship (in the nested objects scenario), you may see the following error if you try to integrate line details using the Business Central OData API destination.
Error: You must specify an Id or Document Id to get the lines.

Cause
In the Business Central OData API destination, the line mapping does not include the required reference to its parent document. The “header create” call returns an ID for the new document, and the line entity must use that value (for example, Documentid/Parentid).
Simply adding a child endpoint does not relate the records automatically; you must capture the header ID and pass it explicitly in the line mapping – specify an ID.
Resolution
To fix this, map the Document ID at the line level from the parent source column.
For example, consider the following:

- Go to the header endpoint > click on the three dots (…)
- Add the id field to capture the newly generated header

- Open the line mapping
- Locate the documentId field and change the Column Type to Parent Source Column
- Map the parent field {HeaderObject}_ID.

Have questions? Please reach out to us at support@eonesolutions.com