Unable to create child and parent table record from api response

Issue: Fetching and setting child table (orders) details from an API, rendering them in a table format, selecting them, and attempting to insert them along with the parent table (vmsTrip) results in the following error:

Error Message:

css

Copy code

Mandatory fields required in vmsTrip - Order Details

Details:
I’m populating order_details dynamically using data fetched from an API based on vmsTrip selections. The child table (order_details) is rendered correctly in the UI, and I’m able to select rows. However, when I try to save the vmsTrip document, it throws the mandatory fields error for order_details.

Steps Taken:

  • Cleared existing order_details before populating new data.
  • Fetched and filtered API data based on vmsTrip selections.
  • Added rows to order_details using frm.add_child.
  • Ensured parenttype, parentfield, and parent fields are set correctly for each child row.

Expected Behavior: I expect that upon saving vmsTrip, both the parent (vmsTrip) and child (order_details) records should save seamlessly without encountering mandatory fields errors.

Request for Assistance: Could someone please guide me on how to resolve this issue and ensure that child rows (order_details) are correctly associated and saved with their parent (vmsTrip) in Frappe?

Thank you!