Skip to content

Exporting data of custom and computed fields


Anindita Basu    Feedback

You can add custom fields and computed fields to the data exporter template. However, to ensure that the data for such fields is downloaded correctly, you must make some changes to the code base.

Context

Fields are of the following three kinds: standard, state, and computed.

Standard fields
Fields that are common across modules and companies are standard fields. Example of standard fields are user_code, user_name, assigned_by_code, or assigned_by_name. The structure of a standard field is like this:
{
  "type": "standard",
  "field": "user_code",
  "title": "User ID",
  "visible": true,
  "sortable": false,
  "group": "1",
  "export": true,
  "fieldType": "text"
      }
State fields
Fields that belong to a state (for example, new, lost, or won) are state fields. The structure of a state field is like this:
{
  "type": "states",
  "state": "tpp_leads_new",
  "field": "customer_id",
  "title": "Customer ID (Tpp Leads New)",
  "visible": true,
  "sortable": false,
  "group": "1",
  "export": true,
  "fieldType": "text"
 }
Computed fields
Fields for which no user input is taken (or no data uploaded) but which are calculated according to some defined formula are computed fields. An example of a computed field is team goal, which can be calculated as the aggregation of the goal assignments of all members of a team. The structure of a computed field is like this:
{
  "type": "computed",
  "field": "profit",
  "title": "Profit Percent",
  "visible": true,
  "sortable": false,
  "group": "1",
  "export": true,
  "fieldType": "text"
  }

Calculations for computed fields are done by templates, which are of two kinds, standard and custom.

Standard templates
These templates are common across companies, and don't contain any customer-specific calculations. Examples of standard templates are GET_MANAGER_DETAILS_NAME, DECRYPT_PII_MOBILE, or DURATION_IN_MINUTES. They're listed in clientGlobalConfig on the JSON interface. Standard templates can't be changed through the JSON interface; they need code-level modifications.
Custom templates
These templates are specific to customers and are listed at exportDataFormats on the JSON interface. These templates can be customized. For example, consider a custom field like this:
{
  "type": "custom",
  "code": "19r6ji",
  "deleted": false,
  "expr": "{{ address_string }}",
  "name": "19r6ji",
  "desc": "19r6ji"
}
To refer to this field through the JSON interface, the code will be like this:
{
  "type": "activity-custom",
  "path": "schedule.location",
  "title": "Location",
  "visible": true,
  "sortable": true,
  "group": 1,
  "export": true,
  "fieldType": "json",
  "filter": true,
  "dataExporter": "19r6ji"
}

The JSON configuration calls the field through its code, which is 19r6ji in this case.

Steps

  1. Add the special field to the data exporter format (Customize > Global Settings > JSON Configurations > exportDataFormats). Use the code of its custom template.
  2. Add the code for the custom field to the dataExporter property of the module or the activity.

See also


Did this page help? No help at allYes, totally!
Back to top