var Events_Component_SendEvent = VTAP.Component.Core.extend({
// created funtion is the entry point for any TAP Script
created(){
// Register for new record
VTAP.Event.Register('RECORD_CREATED',(module,record) => {
if(module == 'Events'){
let contactName = (record.contact_id && record.contact_id[0]) ? record.contact_id[0].label : 'No Name';
}
let params = {
contactName : contactName,
appointment_date : record.date_start,
appointment_time : record.time_start,
location : record.location
}
// Call the API created from API Desginer using VTAP.CustomApi.Post API
VTAP.CustomApi.Post('create_appointment',params,(error,success) => {
if(success){
VTAP.Utility.ShowSuccessNotification():
}
else{
let errorMsg = (error.message) ? error.message : error;
VTAP.Utility.ShowErrorNotification(errorMsg)
}
})
})
}
})