Interface API

You can use Interface APIs to trigger user interface actions on a page. With these APIs, an app can control the visibility of ticket properties, hide or disable buttons, and show dialog boxes and notifications.

Take a look at the Ticket Background app for a demonstration of this feature.

Global Interface APIs

The following APIs can be used in all locations:

Show Modal - Opens a Modal dialog box in an IFrame to display HTML content to users.

Note: Events API and Interface API are not allowed within the Modal IFrame.

template.html

Copied Copy
1
2
3
4
5
6
7
8
client.interface.trigger("showModal", { title: "Sample Modal", template: "modal.html" }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Note:
1) The template field is mandatory, if left empty an error message is displayed.
2) The title field is optional and supports only 30 characters, the rest is truncated. The default title is Modal dialog.

To send data from template.html to the modal, add an additional parameter data as shown in the following code.

template.html

Copied Copy
1
2
3
4
5
6
7
8
9
client.interface.trigger("showModal", { title: "Sample Modal", template: "modal.html", data: {name: "James", email: "James@freshdesk.com"} }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The data can be retrieved inside the modal by using the context API.

modal.html

Copied Copy
1
2
3
4
5
6
client.instance.context().then(function(context){ console.log(context) /* Output: { instanceId: "modalinstanceID", location: "location", parentId: "parentinstanceID", modalData: {name: "James", email: "James@freshdesk.com"} } */ }.catch(function(error) { // error - error object }));

You can transfer data from the modal back to the parent window (or any other location of the same app) by using the Instance API.

If the modal includes features, such as Data API, Request API, Installation Parameters, and Data Storage, you need to include the following Freshclient link in the Modal IFrame.

modal.html

Copied Copy
1
<script src="http://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>

Show Dialog - Shows a dialog box to a user with title and template in an IFrame.

Note:
Show dialog supports all APIs except Events API and Interface API. Also, you can transfer data from the dialog to the app and vice versa by using the Instance API.

Copied Copy
1
2
3
4
5
6
7
8
9
10
client.interface.trigger("showDialog", { title: "Sample Dialog", template: "dialog.html" /*"title" should be plain text.*/ /*"dialog.html" is the "template" within "<yourproject>/app" directory.*/ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Note:
1) The template field is mandatory, if left empty an error message is displayed.
2) The title field is optional and supports only 30 characters, the rest are truncated. The default title is Modal dialog.


Show Confirm - Shows a confirmation dialog with title, message, saveLabel, and cancelLabel to users. By default, the dialog shows Save and Cancel buttons and you can use saveLabel and cancelLabel to modify the button labels.

Note: Timeout for confirmation dialog is 10 seconds.

Sample confirmation dialog with default buttons

Copied Copy
1
2
3
4
5
6
7
8
9
client.interface.trigger("showConfirm", { title: "Sample Confirm", message: "Are you sure you want to close this ticket?" /*"title" and "message" should be plain text.*/ }).then(function(result) { /* "result" will be either "Save" or "Cancel" */ }).catch(function(error) { // error - error object; });

Note:
1) The template field is mandatory, if left empty an error message is displayed.
2) The title field is optional and supports only 30 characters, the rest are truncated. The default title is Modal dialog.
3) The message field supports a maximum of 100 characters.
4) The saveLabel and cancelLabel fields support a maximum of 11 characters.

Sample confirmation dialog with saveLabel and cancelLabel

Copied Copy
1
2
3
4
5
6
7
8
9
client.interface.trigger("showConfirm", { title: "Sample Confirm", message: "Do you want to save the changes?", saveLabel: "save", cancelLabel: "ignore" /*"title" and "message" should be plain text.*/ }).then(function(result) { /* "result" will be either "save" or "ignore" */ }).catch(function(error) { // error - error object; });

Note:
1) The message field is mandatory, if left empty an error message is displayed.
2) The type field is mandatory, if left empty an error message is displayed.
3) The title field is optional and supports only 30 characters, the rest are truncated. The default title is Confirmation title.
4) The message field supports a maximum of 100 characters.
5) For an invalid type, an error message, "Unsupported notification type", will be displayed.


Show Notifications - Shows various types of notifications.

  • Success

    Sample notification with message

    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "success", message: "sample notification" /* The "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

    Sample notification with an optional title

    You can add a title to the notification by including the optional title parameter.
    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "success", title: "Success", message: "This is a sample success notification." /* "title" and "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });
  • Info

    Sample notification with information

    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "info", title: "Info", message: "This is a sample information notification." /* The "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });
  • Warning

    Sample warning notification

    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "warning", title: "Warning", message: "This is a sample warning notification." /* The "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });
  • Danger

    Sample danger notification

    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "danger", title: "Danger", message: "This is a sample danger notification." /* The "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });
  • Alert

    Sample alert notification

    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    client.interface.trigger("showNotify", { type: "alert", title: "Alert", message: "This is a sample alert notification." /* The "message" should be plain text */ }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Navigate to Ticket Details page - Allows users to navigate to the Ticket Details page of the given ticket.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "ticket",value: 1 }) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Navigate to Contact Details page - Allows users to navigate to the Contact Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "contact",value: 1 }) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
Global CTI

The following APIs are available:

Show CTI - Opens an IFrame to show content to users.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "softphone"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide CTI - Hides the IFrame.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "softphone"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Ticket Details Page APIs

Time Entry Modal
Note: For the following APIs, the app location has to be time_entry_background.

Editor Window APIs

Hide Attachments - Hides attachments in conversations on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "attachments"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Attachments - Shows attachments in conversations.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "attachments"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Attachment Delete Buttons - Hides the Attachment Delete button.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "attachmentsDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Attachment Delete Buttons - Shows the Attachment Delete button.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "attachmentsDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Mark as Spam Option - Allows an app to hide the Mark as Spam option.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "ticketSpam"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Edit Ticket Option - Allows an app to hide the Edit ticket option on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "ticketEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Edit Ticket Option - Allows an app to show the Edit ticket option on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "ticketEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable Edit Ticket Option - Allows an app to disable the Edit ticket option on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "ticketEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable Edit Ticket Option - Allows an app to enable the Edit ticket option on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "ticketEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Ticket Delete Button - Hides the ticket Delete button on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "ticketDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Ticket Delete Button - Shows the ticket Delete button on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "ticketDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable Ticket Delete Button - Is used to disable the Ticket delete button on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "ticketDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable Ticket Delete Button - Is used to enable the Ticket delete button on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "ticketDelete"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Ticket Property Fields - Hides the selected ticket properties field on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger ("hide", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists all the property fields that can be hidden.

Element Syntax
Status

client.interface.trigger ("hide", {id: "status"})

Priority

client.interface.trigger ("hide", {id: "priority"})

Type

client.interface.trigger ("hide", {id: "ticket_type"})

Group

client.interface.trigger ("hide", {id: "group"})

Product

client.interface.trigger ("hide", {id: "product"})

Custom field

client.interface.trigger ("hide", {id: "cf_custom_field"})

Tags

client.interface.trigger ("hide", {id: "tag"})

Note:
For the custom field, the name should be of the form cf_your_custom_field_name. For example, if your custom field name is "Agent Number", then your setValue call should be: client.interface.trigger("setValue", { id: "cf_agent_number", value:"121333"});


Show Ticket Property Fields - Shows the selected ticket property field if hidden.

Copied Copy
1
2
3
4
5
6
client.interface.trigger ("show", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists all the supported property fields.

Element Syntax
Status

client.interface.trigger ("show", {id: "status"})

Priority

client.interface.trigger ("show", {id: "priority"})

Type

client.interface.trigger ("show", {id: "ticket_type"})

Group

client.interface.trigger ("show", {id: "group"})

Product

client.interface.trigger ("show", {id: "product"})

Custom field

client.interface.trigger ("show", {id: "cf_custom_field"})

Tags

client.interface.trigger ("show", {id: "tag"})

Disable Ticket Property Fields - Disables the selected ticket property field.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists all the property fields that can be disabled.

Element Syntax
Status

client.interface.trigger ("disable", {id: "status"})

Priority

client.interface.trigger ("disable", {id: "priority"})

Type

client.interface.trigger ("disable", {id: "ticket_type"})

Group

client.interface.trigger ("disable", {id: "group"})

Product

client.interface.trigger ("disable", {id: "product"})

Custom field

client.interface.trigger ("disable", {id: "cf_custom_field"})

Tags

client.interface.trigger ("disable", {id: "tag"})


When you disable the status property, users will not be able to edit the field.

Enable Ticket Property Fields - Enables the selected ticket property field so you can edit its value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists all the supported property fields.

Element Syntax
Status

client.interface.trigger ("enable", {id: "status"})

Priority

client.interface.trigger ("enable", {id: "priority"})

Type

client.interface.trigger ("enable", {id: "ticket_type"})

Group

client.interface.trigger ("enable", {id: "group"})

Product

client.interface.trigger ("enable", {id: "product"})

Custom field

client.interface.trigger ("enable", {id: "cf_custom_field_name"})

Tags

client.interface.trigger ("enable", {id: "tag"})

Set Options of Ticket Property Fields - Allows users to display specific values in a drop-down list; all other values will be hidden.

Copied Copy
1
client.interface.trigger ("setOptions", {id: "property", value: [value1, value2]})

Here, property can be a default or custom drop-down field and value should be an array of comma separated values.

The following table lists the fields for which values can be set.

Property Syntax
Status

client.interface.trigger("setOptions", {id: "status", value: [2, 3, 4]})

Priority

client.interface.trigger("setOptions", {id: "priority", value: [3, 4, 5]})

Ticket type

client.interface.trigger("setOptions", {id: "ticket_type", value: ["incident", "problem", "question"]})

Group

client.interface.trigger("setOptions", {id: "group", value: [10, 11, 12]})

Agent

client.interface.trigger("setOptions", {id: "agent", value: [30, 40, 50]})

Product

client.interface.trigger("setOptions", {id: "product", value: [1, 2, 3]})

Custom field

client.interface.trigger("setOptions", {id: "cf_custom_field_name", value: [3, 4, 5]})

Set Value of Ticket Property Field - Sets the ticket property field with a specified value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setValue", {id: "property", value: "value"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists all the property fields for which values can be set.

Element Syntax
Status

client.interface.trigger("setValue", {id: "status", value: 3})

Priority

client.interface.trigger("setValue", {id: "priority", value: 3})

Ticket

client.interface.trigger("setValue", {id: "ticket_type", value: "Incident"})

Group

client.interface.trigger("setValue", {id: "group", value: 10})

Agent

client.interface.trigger("setValue", {id: "agent", value: 30})

Product

client.interface.trigger("setValue", {id: "product", value: 1})

Custom field

client.interface.trigger("setValue", {id: "cf_custom_field_name", value: 3})

Hide Ticket Due By Link - Is used to hide the ticket due by edit link to prevent any updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "ticketDueBy"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Ticket Due By Link - Shows the ticket due by edit link to allow updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "ticketDueBy"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Start Timer - Is used to start a timer. If a timer is already running, the API will stop the timer and create a new timer.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("start", {id: "timer", value: {agent: user_id, billable: true, note: "text"}}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Stop Timer - Is used to stop a running timer.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("stop", {id: "timer"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Expand Conversation - When the number of notes and replies in a ticket exceeds a certain limit, the older ones are collapsed and only the most recent ones are shown. This API enables you to expand and view all of them.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "expandConversation"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Open Reply and Insert Text - Opens the Reply editor and replaces the existing text with the specified text. Using this API also invokes any callback function if specified by using the ticket.replyClick Event API.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "reply", text: "Text to be inserted"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Open Note and Insert Text - Opens the Note editor and replaces the existing text with the specified text. Using this API also invokes any callback function if specified using the ticket.notesClick Event API.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "note", text: "Text to be inserted", isPublic: true}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Insert Text in Editor window - Is used to insert text and attachments in an already open conversation editor window. It works for notes, replies, and forwards. This is recommended only for apps in the "ticket_conversation_editor" location as it requires the editor window to be already open.

Copied Copy
1
2
3
4
5
6
7
8
client.interface.trigger( "setValue", {id: "editor", text: "Text to be inserted", attachments: [attachment ID1, attachment ID2...]}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

By default, the text is appended at the current cursor position. The optional replace parameter, which is boolean, can be used to replace the existing content or add to it. The optional position parameter, which accepts a value of start or end, can be used to decide if the text is to be added to the start or end of existing content. By default, this value is set to start.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setValue", {id: "editor", text: "Text to be inserted", replace: false, position: "end"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide To - Is used to hide the To field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "to"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show To - Shows the To field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "to"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable To - Is used to disable the To field in the reply editor to prevent any updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "to"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable To - Is used to enable the To field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "to"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide From - Is used to hide the From field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "from"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show From - Is used to show the From field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "from"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable From - Disables the From field in the reply editor to prevent any updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "from"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable From - Enables the From field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "from"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide CC - Is used to hide the cc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "cc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show CC - Is used to show the cc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "cc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable CC - Disables the cc field in the reply editor to prevent any updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "cc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable CC - Enables the cc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "cc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide BCC - Is used to hide the bcc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "bcc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show BCC - Is used to show the bcc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "bcc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable BCC -Disables the bcc field in the reply editor to prevent any updates to the existing value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "bcc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable BCC - Enable the bcc field in the reply editor.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "bcc"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Set Value of Editor Window Fields - Sets the editor window field (To, From, CC, BCC) with the specified value.

Copied Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
client.interface.trigger("setValue", {id: "property", value: ["value"]}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object }); // For multiple values client.interface.trigger("setValue", {id: "property", value: ["value_1", "value_2"..]}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
EXPAND ↓

The following table lists all the fields for which values can be set.

Element Syntax
To

client.interface.trigger("setValue", {id: "to", value: ["tom@customer.com"]})

From

client.interface.trigger("setValue", {id: "from", value: "rachel@freshdesk.com"})

CC

client.interface.trigger("setValue", {id: "cc", value: ["rachel@freshdesk.com"]})

BCC

client.interface.trigger("setValue", {id: "bcc", value: ["rachel@freshdesk.com"]})

Hide Note Button - Hides the Add note button in all the locations such as Ticket top navigation and bottom coversation bars.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "note"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Note Button - Shows the Add note button in all locations such as Ticket top navigation and bottom conversation bars.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "note"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Disable Note Button - Disables the note option in the top navigation bar and hides the note option in the bottom conversation bar.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "note"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Enable Note Button - Enables the note option in the top navigation and bottom conversation bars.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "note"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide Edit Option in Notes - Hides the Edit option in Notes.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "noteEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Edit Option in Notes - Shows the Edit option in Notes.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "noteEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Set Note Options - Enables you to set either the public or private note option as default and hide the other one.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setOptions", {id: "note", value: ["value"]}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Example

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setOptions", {id: "note", value: ["Public"]}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Set Note Type - Enables you to set the note type to either private or public.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setValue", {id: "noteType", value: "value"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
Sample Copied Copy
1
2
3
4
5
6
client.interface.trigger("setValue", {id: "noteType", value: "private"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Set Notify to Field - Enables you to set or clear the Notify to field in Notes.

Copied Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
client.interface.trigger("setValue", {id: "note", toAddress: "value"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object }); // For multiple values client.interface.trigger("setValue", {id: "note", toAddress: "value_1, value_2"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object }); // To clear the field client.interface.trigger("setValue", {id: "note", toAddress: ""}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
EXPAND ↓

Hide Reply Button - Hides the reply option in all the locations such as Ticket top navigation and bottom coversation bars.

Copied Copy
1
client.interface.trigger("hide", {id: "reply"})

Show Reply Button - Shows the reply option in all locations such as Ticket top navigation and bottom conversation bars.

Copied Copy
1
client.interface.trigger("show", {id: "reply"})

Hide Forward Button - Hides the forward option in all the locations such as Ticket top navigation and bottom coversation bars.

Copied Copy
1
client.interface.trigger("hide", {id: "forward"})

Show Forward Button - Shows the forward option in all locations such as Ticket top navigation and bottom conversation bars.

Copied Copy
1
client.interface.trigger("show", {id: "forward"})

Remove Quoted Text in Ticket Reply Editor - Allows an app to remove quoted text when you click the Reply button on the Ticket Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("click", {id: "deleteQuotedText"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Hide - Is used to hide the following fields.

  • timerBillable
  • timerAgentId
  • timerNote
  • timerSetTime
  • timerExecuteAt

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

In the given code, "element" can be replaced with the above listed fields.

Show - Shows the following fields.

  • timerBillable
  • timerAgentId
  • timerNote
  • timerSetTime
  • timerExecuteAt

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

In the given code, "element" can be replaced with the above listed fields.

Enable - Is used to enable the following fields.

  • timerBillable
  • timerAgentId
  • timerNote
  • timerSetTime
  • timerExecuteAt

Copied Copy
1
2
3
4
5
6
client.interface.trigger("enable", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

In the given code, "element" can be replaced with the above listed fields.

Disable - Is used to disable the following fields.

  • timerBillable
  • timerAgentId
  • timerNote
  • timerSetTime
  • timerExecuteAt

Copied Copy
1
2
3
4
5
6
client.interface.trigger("disable", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

In the given code, "element" can be replaced with the above listed fields.

Set Value - Sets the fields (timerBillable, timerAgentId, timerNote, timerSetTime) with a specified value.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("setValue", {id: "property", value: "value"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

In the given code, "property" can be replaced with the above fields.

  • timerBillable - value can be either true or false.
  • client.interface.trigger("setValue", {id: "timerBillable", value: false})
  • timerAgentId - value is an integer and should be the agent's user_id.
  • client.interface.trigger("setValue", {id: "timerAgentId", value: 147})
  • timerNote - value is a string.
  • client.interface.trigger("setValue", {id: "timerNote", value: "time sheet value"})
  • timerSetTime - value is a string (ie.) "1" or "1:30" or "1.5".
  • client.interface.trigger("setValue", {id: "timerSetTime", value: "1:15"})
  • timerExecuteAt - value is in date format "DD/MMM/YYYY" or "DD-MMM-YYYY".
  • client.interface.trigger("setValue", {id: "timerExecuteAt", value: "24/june/2018"})

    Note:
    If the timerSetTime field is blank, the timerExecutedAt field is set to the current date even if an app tries to set a value for the same.

Contact Details Page

Hide Contact Edit Button/Fields - Hides the Contact Edit button or any particular field on the Contact Details page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

The following table lists the supported button/fields.

Button/Field Name Syntax
Edit Button

client.interface.trigger ("hide", {id: "contactEdit"})

Tags

client.interface.trigger ("hide", {id: "tag"})

Mobile Phone

client.interface.trigger ("hide", {id: "mobile"})

Address

client.interface.trigger ("hide", {id: "address"})

Work Phone

client.interface.trigger ("hide", {id: "phone"})

Twitter ID

client.interface.trigger ("hide", {id: "twitter_id"})

Language

client.interface.trigger ("hide", {id: "language"})

About

client.interface.trigger ("hide", {id: "description"})

Any Custom Fields

client.interface.trigger ("hide", {id: "cf_zip_code"})

Note: For the custom field, the name should be of the form cf_your_custom_field_name.

Show Contact Edit Button/Fields - Shows the Contact Edit button or any particular field on the Contact Details page. See the above table for the list of buttons/fields that can be displayed.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "element"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
Contact List Page

Hide Contact Edit Button - Hides the Contact Edit button on the Contact List page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("hide", {id: "contactEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Contact Edit Button - Shows the Contact Edit button on the Contact List page.

Copied Copy
1
2
3
4
5
6
client.interface.trigger("show", {id: "contactEdit"}) .then(function(data) { // data - success message }).catch(function(error) { // error - error object });
New Ticket Page APIs

The following APIs are available to all apps that are located on the New Ticket page:

The following table lists the actions supported by the requester field.

Action Syntax
Hide

requesterclient.interface.trigger ("hide", {id: "requester"})

Show

requesterclient.interface.trigger ("show", {id: "requester"})

Set Value

requesterclient.interface.trigger ("setValue", {id: "requester", value: "James@freshdesk.com"})

Disable

requesterclient.interface.trigger ("disable", {id: "requester"})

Enable

requesterclient.interface.trigger ("enable", {id: "requester"})

New Email Page APIs

The following APIs are available to all apps that are located on the New Email page:

The following table lists the actions supported by the requester field.

Action Syntax
Hide

requesterclient.interface.trigger ("hide", {id: "requester"})

Show

requesterclient.interface.trigger ("show", {id: "requester"})

Set Value

requesterclient.interface.trigger ("setValue", {id: "requester", value: "James@freshdesk.com"})

Disable

requesterclient.interface.trigger ("disable", {id: "requester"})

Enable

requesterclient.interface.trigger ("enable", {id: "requester"})