0

I have a custom record "customrecord_mr23_perfil", and a child record "customrecord_mr23_perfilprice".

In netsuite, I can insert this data at the same time

enter image description here

how can i do this with a json, do I have to post once for the parent record and another one for each child?

I can insert a record in the parent record with the following JSON

{
    "custrecord_mr23_perfil_class":15,
    "custrecord_mr23_perfil_noperfil":100,
    "custrecord_mr23_perfil_cliente":6467,
    "custrecord_mr23_perfil_descripcioningles":"Aerosols",
    "custrecord_mr23_perfil_descripcion":"Aerosoles"          
}

and I can insert a child record with this json:

{
           
            "custrecord_mr23_perfilprice_contenedorre":"1",
            "custrecord_mr23_perfilprice_contfactura":"1",
            "custrecord_mr23_perfilprice_moneda":"1",
            "custrecord_mr23_perfilprice_pesomaximo":400,
            "custrecord_mr23_perfilprice_precio":66,
            "custrecord_mr23_perfilprice_precioexcede":0.11,            
            "custrecordmr23_perfilprice_perfil":"105"

}

but when I try to insert the parent and child records at the same time

{
   
    "custrecord_mr23_perfil_class":15,
    "custrecord_mr23_perfil_noperfil":100,
    "custrecord_mr23_perfil_cliente":6467,
    "custrecord_mr23_perfil_descripcioningles":"Aerosols",
    "custrecord_mr23_perfil_descripcion":"Aerosoles",
    
    "recmachcustrecordmr23_perfilprice_perfil": 
        [
        {
            
            "custrecord_mr23_perfilprice_contenedorre":"1",
            "custrecord_mr23_perfilprice_contfactura":"1",
            "custrecord_mr23_perfilprice_moneda":"1",
            "custrecord_mr23_perfilprice_pesomaximo":400,
            "custrecord_mr23_perfilprice_precio":66,
            "custrecord_mr23_perfilprice_precioexcede":0.11
    
           
        }
        ]
        
}

I get the following error:

{
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title": "Bad Request",
    "status": 400,
    "o:errorDetails": [
        {
            "detail": "Invalid content in the request body.",
            "o:errorCode": "INVALID_CONTENT"
        }
    ]
}

1 Answers1

0

From your screenshot, seem like its at edit mode means the parent record already saved.

Just to confirm if this "Allow Child Record Editing" is ticked at the child record ? This will allow you to input both parent and child record during record creation from UI.

Not sure if this is the caused and will work the same in scripting.

Mingo
  • 58
  • 5
  • Yes, I have "Allow Child Record Editing" option and I can edit both records in UI, but I'm trying to do the same in Rest. – Paul Orozco Nov 07 '22 at 15:20