Use events method

Front-end events are actions on the product UI, such as button clicks and changes/updates to the UI field values. Events method is an interface that the developer platform provides, to enable your app to react to front-end events.

To enable your app to react to front-end events, in the app.js file,

  1. Subscribe to the app.initialized event, through an event listener. When the app is initialized, the parent application passes a client reference to the app.
  2. After app initialization,
    1. Use the client reference, subscribe to <Event name> and register a callback method to be executed when the event occurs.
    2. Define the callback method.

When the event occurs, a payload is passed to the callback method. Let us call this payload event. event.type returns the name of the event. The event.helper.getData() helper method returns a JSON object that contains information pertaining to the event. Your app logic can process this data into meaningful results.

This section,

  • Lists, page-wise, all the front-end events to which the app can react.
  • Provides sample payloads that are passed to the callback methods, when the events occur.
  • Describes the payload attributes.

Click events

These events occur when a user clicks a button or link on the page. The event.helper.getData() method returns an empty JSON for most of these events, the only exception being timer and cti.triggerDialer events.

Change events

These events occur when a user changes the value of a field on the UI.

Note:User need not submit the modified value for the event listeners to pick up the event and execute the callback; merely changing the values is sufficient for the event trigger.

The event.helper.getData() method returns a JSON that contains the old and new values of the changed field.

Intercept events

These are events that are paused, while the event listener and the corresponding callback run. The app can choose to allow the original event to complete or block the event.

To enable your app to intercept an event, after app initialization,

  1. Use the client reference, subscribe to event, register a callback method to be executed when the event occurs, and set intercept as true.
  2. Define the callback method.
  3. To allow the event to proceed, use the event.helper.done() helper method.
  4. To prevent the event from completion, use the event.helper.fail(‘errorMessage’) helper method.
  5. To obtain data pertaining to the event, use the event.helper.getData() helper method. If your app is intercepting a click event, the method returns an empty JSON.

Common event

If your app is built to be deployed on the cti_sidebar placeholder, the app can react to the cti.triggerDialer event when the corresponding event trigger occurs.

Event nameEvent trigger
cti.triggerDialerWhen a user clicks the call icon or phone number link that is displayed on any of the following pages of the product UI:
  • Ticket details page > CONTACT DETAILS widget
  • Ticket list page > Contact hover card
  • New ticket page > CONTACT DETAILS widget
  • Contact list page > Contact hover card
  • Contact details page > Contact header and DETAILS widget

cti.triggerDialer

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to user clicks such as the click on a call icon or phone number, on the UI.

Ticket details page events

Event nameEvent trigger
Click events
ticket.replyClickWhen a user clicks the Reply button to open the editor window.
ticket.sendReplyWhen a user clicks the Send button.
ticket.forwardClickWhen a user clicks the Forward button to open the editor window.
ticket.conversationForwardWhen a user clicks the Forward icon in the conversation.
ticket.forwardWhen a user clicks the Forward button inside the editor window, the ticket or conversation is forwarded.
ticket.notesClickWhen a user clicks the Notes button to open the editor window.
ticket.addNoteWhen a user clicks the Add Note option from the editor window, a private or public note is added.
ticket.closeTicketClickWhen a user clicks the Close button located on the top navigation bar of the Ticket details page.
ticket.deleteTicketClickWhen a user clicks the Delete button located on the top navigation bar of the Ticket details page.
ticket.previousTicketClickWhen a user clicks the previous ticket icon at the top right of the Ticket details page.
ticket.nextTicketClickWhen a user clicks the next ticket icon at the top right of the Ticket details page.
ticket.startTimerWhen a user clicks the Start or Add Timer button.
ticket.stopTimerWhen a user clicks the Stop Timer button.
ticket.updateTimerWhen a user clicks the Update Timer button.
ticket.deleteTimerWhen a user clicks the Delete Time Entry button.
Change events
ticket.priorityChangedWhen a user changes the priority of a ticket.
ticket.statusChangedWhen a user changes the status of a ticket.
ticket.groupChangedWhen a user changes the group to which a ticket is assigned.
ticket.agentChangedWhen a user changes the agent to whom the ticket is assigned.
ticket.typeChangedWhen a user changes the type of the ticket.
Intercept events
ticket.closeTicketClickWhen a user clicks the Close button located on the top navigation bar of the Ticket details page.
ticket.deleteTicketClickWhen a user clicks the Delete button located on the top navigation bar of the Ticket details page.
ticket.propertiesUpdatedWhen a user updates any ticket property and clicks the Update button on the Ticket details page.
ticket.sendReplyWhen a user clicks the SEND button on the Ticket details page.

New ticket page events

Event nameEvent trigger
Change events
ticket.priorityChangedWhen a user changes the priority of a ticket.
ticket.statusChangedWhen a user changes the status of a ticket.
ticket.groupChangedWhen a user changes the group to which a ticket is assigned.
ticket.agentChanged When a user changes the agent to whom a ticket is assigned.
ticket.typeChangedWhen a user changes the type of a ticket.

Event and payload descriptions

ticket.replyClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Reply button that opens the editor window.

ticket.sendReply

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Send button.

ticket.forwardClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Forward button that opens the editor window.

ticket.conversationForward

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Forward icon in the conversation that opens the editor window.

ticket.forward

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Forward button in the editor window to forward the ticket or conversation.

ticket.notesClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Add note button that opens the editor window.

ticket.addNote

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Add Note button in the editor window, which adds a private or public note to the ticket.

ticket.closeTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Close button located on the top navigation bar of the Ticket details page.

ticket.deleteTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Delete button located as a menu item in the Ticket details page.

ticket.previousTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Previous icon located at the top right of the Ticket details page.

ticket.nextTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Next icon located at the top right of the Ticket details page.

ticket.startTimer

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Start Timer button to start the timer from the TIME LOGS widget. It is also triggered when the user adds a time entry and clicks the Save button.

ticket.stopTimer

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Stop button to stop a running timer.

ticket.updateTimer

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the UPDATE button to update an existing time entry.

ticket.deleteTimer

The event is triggered when a user deletes an existing time entry. Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Delete button to delete an existing time entry.

ticket.priorityChanged

Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the priority of a ticket.

ticket.statusChanged

Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the status of a ticket.

ticket.groupChanged

Use the sample code shown on the right pane > Sample code tab, to enable your app to react twhen a user changes the group assigned to a ticket.

ticket.agentChanged

Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the agent assigned to a ticket.

ticket.typeChanged

Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the type of a ticket.

ticket.closeTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Close button located on the top navigation bar of the Ticket details page.

ticket.deleteTicketClick

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the the Delete button located as a menu item in the Ticket details page.

ticket.propertiesUpdated

Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user updates any ticket property and clicks the Update button located in the PROPERTIES section of the Ticket details page.

ticket.sendReply

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to a user's click on the Send button in the editor window.