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. 


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);
}


    • Sticky Posts

    • Kaizen #222 - Client Script Support for Notes Related List

      Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
    • Kaizen #217 - Actions APIs : Tasks

      Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
    • Kaizen #216 - Actions APIs : Email Notifications

      Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
    • Kaizen #152 - Client Script Support for the new Canvas Record Forms

      Hello everyone! Have you ever wanted to trigger actions on click of a canvas button, icon, or text mandatory forms in Create/Edit and Clone Pages? Have you ever wanted to control how elements behave on the new Canvas Record Forms? This can be achieved
    • Kaizen #142: How to Navigate to Another Page in Zoho CRM using Client Script

      Hello everyone! Welcome back to another exciting Kaizen post. In this post, let us see how you can you navigate to different Pages using Client Script. In this Kaizen post, Need to Navigate to different Pages Client Script ZDKs related to navigation A.