📜  ZOHO API 按 ID 获取记录 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:55.655000             🧑  作者: Mango

代码示例1
//Looking up a record by its ID
function get_rec_by_ID() {
    ZOHO.CREATOR.init().then(function (data) {
        console.log('Fetching a specific record...');
        let report_n = 'All_Visitors';
        function getGLOBAL_ID() {
            ID_GLOBAL = inp_ID_nr.value;
            return ID_GLOBAL;
        }
        getGLOBAL_ID();
        let digit_19_ID = ID_GLOBAL;
        let config = {
            reportName: 'All_Visitors',
            id: digit_19_ID
        };
        console.log('Config sent', config);
        ZOHO.CREATOR.API
            .getRecordById(config)
            .then(function (response) {
                console.log('Response code received from Zoho: ', response.code);
                if (response.code == 3000) {
                    console.log('Response data received from Zoho: ', response);
                    inp_ID_nr.value = '';
                    //disable_inputs();
                    console.log(`response.data= ${response.data.Number}`);
                    field_name.name.value = response.data.f_Name;
                    field_name.surname.value = response.data.l_Name;
                    field_name.email.value = response.data.Email;

                    field_name.subform_19_id.value = response.data.Number;
                    let name_now = field_name.name.value.value;
                    let surname_now = field_name.surname.value;
                    let email_now = field_name.email.value;

                    get_all_recs();
                    after_get_by_ID();
                }
            })
            .catch(function (data) {
                alert(data.responseText);
                console.log('Boss, we have a little problem');
                console.log(data.responseText);
                reset_the_form();
            });
    });
}