You can use data methods to retrieve information about different objects on a page.
Global Data APIs
The following objects can be used in all locations and retrieved using data methods:
loggedInUser
Returns details of the user who is logged into the Freshsales Suite UI.
Copied Copy1 2 3 4 5 6 7 8 | client.data.get("loggedInUser").then ( function(data) { // success operation }, function(error) { // failure operation } ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | "loggedInUser":{ "id":42528, "display_name":"Joe Doe", "email":"joe.doe@freshworks.com", "is_active":true, "work_number":null, "mobile_number":null, "confirmed":true, "privileges":"13221119178788", "job_title":"Engineer", "language":"en", "last_login_at":"2020-08-17T18:38:38+05:30", "time_zone":"Chennai", "avatar":null, "signature":null, "access_scope":"global", "abilities":[ "manage_contacts", "view_contacts", "create_contacts", "edit_all_contacts", "delete_all_contacts", "view_sales_accounts", "create_sales_accounts", "edit_all_sales_accounts", "delete_all_sales_accounts", "view_deals", "create_deals", "edit_all_deals", "delete_all_deals", "common_user_actions" ], "reply_to":"name@mkp.myfreshworks.com", "from":"joe.doe@freshworks.com", "plan_name":"sales360_estate", "imap_configured_email":"", "deal_pipeline_id":29368, "created_at":"2020-07-10T12:07:34+05:30", "is_forgotten":false, "role_id":70841, "territory_ids":[], "account_id":1594363054, "sales_activity_type_ids":[ 78175, 78176, 78177, 78178, 78179, 78180, 78181 ] } |
Attributes of the loggedInUser object
ATTRIBUTE | DATA TYPE | DESCRIPTION |
---|---|---|
id | number | Identifier of the user. |
display_name | string | Display name of the user. |
string | Email address of the user. | |
is_active | boolean | Specifies whether the user is active to accept new leads, contacts, tasks, appointments, and so on. |
work_number | string | Official number of the user. |
mobile_number | string | Mobile number of the user. |
confirmed | boolean | Specifies whether the user has accepted the account activation mail. |
privileges | string | Access privileges assigned to the user, specified through a role id. |
job_title | string | Designation of the user. |
language | string | Language of the user; by default, language is en. |
last_login_at | string | Last logged timestamp of the user, specified in the UTC format. |
time_zone | string | Time zone of the user. |
avatar | string | Avatar URL. |
signature | string | Email signature of the user in HTML format. |
access_scope | string | Access scope of the user based on the role assigned to the user. The access can be global, restricted, or territory. |
abilities | array | Actions the user can perform, based on the role assigned to the user. |
reply_to | string | Email address in which the user can receive responses. |
from | string | Email address using which the user can send emails from the Freshsales Suite account. |
plan_name | string | Freshsales Suite plan under which the user’s account falls. |
imap_configured_email | string | User’s email address that is connected to Freshsales Suite so that all prospect details are received directly in the product. |
deal_pipeline_id | string | Identifier of preferred deal pipeline that is associated with the user.. |
created_at | string | Timestamp of when the logged in user’s details are saved in Freshsales Suite, specified in the UTC format. |
is_forgotten | boolean | Specifies whether the user details are permanently deleted from the Freshsales Suite system. |
role_id | number | Identifier of the role associated with the user. When a role is configured in Freshsales Suite, an auto-generated identifier is associated with the role. |
territory_ids | array of strings | Identifiers of the territories to which the user is associated for auto-assignment of prospects. |
account_id | number | Identifier of the Freshsales Suite account to which the user is associated. |
sales_activity_type_ids | array of numbers | Identifiers of all sales activity types configured for a user |
domainName
Returns the domain name of the business account that uses Freshsales Suite and a product context that can be used in the app logic.
Copied Copy1 2 3 4 5 6 7 8 | client.data.get("domainName").then ( function(data) { // success operation }, function(error) { // failure operation } ); |
Sample payload
Copied Copy1 2 3 4 5 6 7 | { domainName:"sample.myfreshworks.com", productContext:{ url:"https://sample.myfreshworks.com/crm", name:"freshworks_crm" } } |
Attributes of the payload
Attribute Name | Data Type | Description |
---|---|---|
domainName | string | Domain name assigned by Freshworks, for a business account. If the app is deployed on an Freshsales Suite account, the domainName is <sub-domain>.myfreshworks.com. If the app is deployed on a Freshsales Suite account that has been migrated from a Freshsales Classic account, the domainName is <sub-domain>.freshworks.com. |
productContext | object | Product context of the product for which the app is installed. Attributes:
|
Contact Details Page
currentEntityInfo
Returns details of a contact, when an agent is on the Contact Details page.
Copied Copy1 2 3 4 5 6 7 8 9 | client.data.get("currentEntityInfo").then ( function(data) { // success output for contact // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "contact"}} }, function(error) { // failure operation } ); |
Payload Response
1 2 3 4 5 6 | { "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "contact" } } |
Attributes of the currentEntityInfo object
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
currentEntityId | number | Identifier of the contact. |
currentEntityType | string | Type of page. |
Deal Details Page
currentEntityInfo
Returns details of a deal, when an agent is on the Deal Details page.
Copied Copy1 2 3 4 5 6 7 8 9 | client.data.get("currentEntityInfo").then ( function(data) { // success output for deal // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "deal"}} }, function(error) { // failure operation } ); |
Payload Response
1 2 3 4 5 6 | { "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "deal" } } |
Attributes of the currentEntityInfo object
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
currentEntityId | number | Identifier of the deal. |
currentEntityType | string | Type of page. |
Sales Account Details Page
currentEntityInfo
Returns details of an account, when an agent is on the Sales Account Details page.
Copied Copy1 2 3 4 5 6 7 8 9 | client.data.get("sales_account").then ( function(data) { // success output for account // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "sales_account"}} }, function(error) { // failure operation } ); |
Payload Response
1 2 3 4 5 6 | { "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "sales_account" } } |
Attributes of the currentEntityInfo object
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
currentEntityId | number | Identifier of the account. |
currentEntityType | string | Type of page. |