Interface API

You can use Interface APIs to trigger user interface actions on a page. For example, you can open the Add Manual Call Log page after a phone call.

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
client.interface.trigger("showModal", { title: "Sample Modal", template: "modal.html" }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

If your app includes services, such as Data API and Request API, you need to include the following Freshclient link within the Modal IFrame.

modal.html

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

Show Confirm - Displays a confirmation dialog with title and message to users. By default, the dialog shows the Cancel and Save buttons.

Note: Maximum recommended character length for The Save and Cancel label is 20.


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 deal?" }).then(function(data) { // data - success message }).catch(function(error) { // error - error object }); /*"title" and "message" should be plain text.*/

Sample confirmation dialog with saveLabel and cancelLabel

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

Show Notifications - Display notifications with type and message. Following are the different types of notifications that you can use:

Sample notification with message

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

Open Create Lead - Opens the create lead dialog.

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

Open Create Contact - Opens the create contact dialog.

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

Open Create Account - Opens the create account dialog.

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

Open Create Deal - Opens the create deal dialog.

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

Open Create Call Log - Opens the create call log dialog.

Copied Copy
1
2
3
4
5
6
id: "calllog" }).then(function(data) { // data - success message }).catch(function(error) { // error - error object });

Show Lead - Is used to navigate to the Lead Details page.

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

Show Contact - Is used to navigate to the Contact Details page.

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

Show Account - Is used to navigate to the Account Details page.

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

Show Deal - Is used to navigate to the Deal Details page.

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