Unable to retrieve Contact_Name field contents using Web API in javascript function

Unable to retrieve Contact_Name field contents using Web API in javascript function

Hello,

I've added a field in the Purchase Order form to select and associate a Sales Order (Orden_de_venta, lookup field). I've also created a client script to complete some fields from the Sales Order (and the Quote), when the user specifies the related SO (field onChange).

In this script there are two fields, one of then is been loaded and the other not, the difference is one is a single line field (envio_direccion) and the other one is a lookup to Contacs (envio_contacto).
I also need to retrieve the Contact_Name from the Sales Order to a third field (so_contacto).

I'll appreciate some link/guidance on where can I find documentation (like this one below), I've never did much javascript before and I'm new to Zoho so I'm struggling a little. 

https://www.zohocrm.dev/explore/client-script/webapi/Modules#fetch 

Thanks in advance!



var ov = ZDK.Page.getField("Orden_de_venta");

if (ov) {
    var orden = ov.getValue();
    if (orden && orden.id) {
        var ovId = orden.id;

        var orden = ZDK.Apps.CRM.Sales_Orders.fetchById(ovId);
        var regpresupuesto = ZDK.Apps.CRM.Quotes.fetchById(orden.Quote_Name_Lookup_Id);
       
        if (regpresupuesto && regpresupuesto.id) {

            var direnvio = ZDK.Page.getField("envio_direccion");
            direnvio.setValue(regpresupuesto.Direcci_n_de_env_o);  // this is working

            var contactoenvio = ZDK.Page.getField("envio_contacto");
            contactoenvio.setValue(regpresupuesto.Contact_Name);      //this is NOT working

var contactoOV = ZDK.Page.getField("so_contacto");
            contactoOV.setValue(orden. ??? ); // I also need the contact_name from the SO

        } else {
            limpiaCampospresupuesto();
        }
    }
    else {
        limpiaCampospresupuesto();
    }
}
else {
        limpiaCampospresupuesto();
}

function limpiaCampospresupuesto() {
    var direnvio = ZDK.Page.getField("envio_direccion");
    direnvio.setValue(null);
    var contactoenvio = ZDK.Page.getField("envio_contacto");
    contactoenvio.setValue(null);
}