📜  ZOHO API 添加记录 - 任何代码示例

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

代码示例1
//Adding a new record
function add_new_rec() {
    console.log('Invoking add new');

    ZOHO.CREATOR.init().then(function (data) {
        let add_Name = field_name.name.value; //First name
        let add_Surname = field_name.surname.value; //Last name
        let add_Email = field_name.email.value; //Email

        let form_n = 'Visitors';
        formData = {
            data: {
                f_Name: add_Name,
                l_Name: add_Surname,
                Email: add_Email
            }
        };
        console.log(formData);

        let config = {
            formName: form_n,
            data: formData
        };
        ZOHO.CREATOR.API
            .addRecord(config)
            .then(function (response) {
                console.log('Adding record...');
                console.log(response);
                if (response.code == 3000) {
                    console.log('Record added successfully');

                    alert('Record updated successfully');
                    console.log(response.data.ID);
                    reset_the_form();
                    get_all_recs();
                }
            })
            .catch(function (data) {
                alert(data.responseText);
                console.log('Boss, we have a little problem');
                console.log(data.responseText);
                reset_the_form();
            });
    });
}