📅  最后修改于: 2022-03-11 14:56:29.494000             🧑  作者: Mango
//Delete a record from the database
function delete_rec() {
console.log('DELETE BUTTON CLICKED');
console.log(ID_GLOBAL);
ZOHO.CREATOR.init().then(function (data) {
//Code goes here
let criteria = `ID==${ID_GLOBAL}`;
let delete_report_name = 'All_Visitors';
console.log(criteria);
console.log(delete_report_name);
config = {
reportName: delete_report_name,
criteria: criteria
};
console.log(config);
ZOHO.CREATOR.API
.deleteRecord(config)
.then(function (response) {
if (response.code == 3000) {
alert('The record has been deleted');
console.log('Record has been deleted');
get_all_recs();
reset_the_form();
}
})
.catch(function (data) {
alert(data.responseText);
console.log('Mielie Failed transaction: ', data.status);
console.log('Object Received: ', data);
console.log('Response Text: ', data.responseText);
console.log('Error Text: ', data.errorText);
console.error();
});
});
}