


Fields | Date Type |
Contact Name | Lookup |
Customer Impact | Multiline |
| Desk Ticket | URL |
Escalation Reason | Multiline |
Expected Closure Date | Date Time |




ZOHO.embeddedApp.on("PageLoad", function(data) { console.log("Escalation popup loaded with data:", data); }); ZOHO.embeddedApp.init(); // Confirm escalation - close popup and return confirmed: true document.getElementById('confirmBtn').addEventListener('click', function() { $Client.close({ confirmed: true }); }); // Cancel escalation - close popup and return confirmed: false document.getElementById('cancelBtn').addEventListener('click', function() { $Client.close({ confirmed: false }); }); |
// Escalate a ticket using openPopup async function escalateTicket(ticketId, subject) { try { // Open the escalation confirmation popup widget var result = await ZDK.Client.openPopup({ api_name: 'Zoho_Desk_Pop_Up', type: 'widget', animation_type: 6, header: 'Escalate Ticket', bottom: 'center', height: '250px', width: '400px' }, { ticketId: ticketId, subject: subject }); console.log("Popup result:", result); // If user clicked Confirm if (result && result.confirmed) { ZDK.Client.showLoader('Escalating ticket...'); // Update ticket status to "Escalation from Zoho CRM" using Desk Update Tickets API const updateResponse = await deskZrc.patch('/tickets/' + ticketId, { status: 'Escalation From Zoho CRM' }); console.log("Update Ticket Response:", updateResponse); ZDK.Client.hideLoader(); ZDK.Client.showMessage('Ticket escalated successfully'); // Show escalation details form var ticketUrl = 'https://desk.zoho.com/agent/zylkerpvtltd/zylker/tickets/details/' + ticketId; renderEscalationForm(ticketId, ticketUrl, subject); } } catch (error) { ZDK.Client.hideLoader(); console.error('Error escalating ticket:', error); ZDK.Client.showAlert('Failed to escalate the ticket. Please try again.', 'Error'); } } |
// Save escalation record to Zoho CRM async function saveEscalationRecord(ticketUrl, ticketSubject) { var customerImpact = document.getElementById('customerImpact').value.trim(); var escalationReason = document.getElementById('escalationReason').value.trim(); var expectedClosureDate = document.getElementById('expectedClosureDate').value; if (!customerImpact || !escalationReason || !expectedClosureDate) { ZDK.Client.showAlert('Please fill in all fields before saving.', 'Validation Error'); return; } // Format datetime with timezone offset for CRM var dateObj = new Date(expectedClosureDate); var tzOffset = -dateObj.getTimezoneOffset(); var tzSign = tzOffset >= 0 ? '+' : '-'; var tzHours = String(Math.floor(Math.abs(tzOffset) / 60)).padStart(2, '0'); var tzMins = String(Math.abs(tzOffset) % 60).padStart(2, '0'); var closureDate = dateObj.getFullYear() + '-' + String(dateObj.getMonth() + 1).padStart(2, '0') + '-' + String(dateObj.getDate()).padStart(2, '0') + 'T' + String(dateObj.getHours()).padStart(2, '0') + ':' + String(dateObj.getMinutes()).padStart(2, '0') + ':' + String(dateObj.getSeconds()).padStart(2, '0') + tzSign + tzHours + ':' + tzMins; var recordData = [{ "Name": ticketSubject, "Customer_Impact": customerImpact, "Escalation_Reason": escalationReason, "Expected_Closure_Date": closureDate, "Desk_Ticket": ticketUrl, "Contact_Name": { "id": entityId } }]; try { ZDK.Client.showLoader('Saving escalation record...'); const crmResponse = await zrc.post('/crm/v8/Escalation_Work_Items', { data: recordData }); console.log("CRM Insert Response:", crmResponse); ZDK.Client.hideLoader(); ZDK.Client.showMessage('Escalation record created successfully'); // Go back to tickets list await loadTickets(); } catch (error) { ZDK.Client.hideLoader(); console.error('Error creating escalation record:', error); ZDK.Client.showAlert('Failed to create escalation record. Please try again.', 'Error'); } } |



All-in-one knowledge management and training platform for your employees and customers.
Writer is a powerful online word processor, designed for collaborative work.