Skip to main content
Skip table of contents

Zendesk advanced settings

This page describes advanced Zendesk and flex.bi integration. If you need help with this please contact flex.bi support.

If you have larger number of Zendesk tickets then it is better to import calculated custom fields and not to create calculated members with complex MDX formulas. Calculated custom fields are pre-calculated just once during Zendesk import and then saved in the flex.bi database and then flex.bi queries will perform much faster using pre-calculated data.

Define calculated custom field in Zendesk import advanced settings

In eayzBI Zendesk import options select Add advanced settings and enter the information about the additional custom field (see the example below):

  • Use your own customfield_NAME custom field name where NAME is some unique descriptive name of your additional calculated custom field.
  • Add a name setting and specify a display name for this calculated custom field that will be visible in Zendesk import custom fields selection.
  • Add javascript_code which will calculate the custom field value and add it to the ticket.custom_fields array. This JavaScript code can use the ticket object in the same way as in the custom JavaScript code.

Here is an example of a calculated custom field "Tickets overdue" which will return 1 if the ticket has a due date and either resolution date is after the due date (for solved tickets) or the due date is in the past (for unsolved tickets). Add to the advanced settings:

CODE
[customfield_overdue]
name = "Tickets overdue"
data_type = "integer"
measure = true
javascript_code = '''
if (ticket.due_at) {
  var resolutionOrCurrentTimestamp = ticket.metric_set.solved_at ?
    Date.parse(ticket.metric_set.solved_at) : (new Date).getTime();
  if (Date.parse(ticket.due_at) < resolutionOrCurrentTimestamp) {
    ticket.custom_fields.push({id: "overdue", value: 1});
  }
}
'''

Then import "Tickets overdue" custom field as a measure and flex.bi will create measures "Tickets overdue created", "Tickets overdue due" (total of unsolved tickets that are past their due date), "Tickets overdue resolved" (total of solved tickets that were late).

If you would like to test and debug your JavaScript code then paste you code in Custom JavaScript code and specify a ticket number on which you would like to test your JavaScript code. Click Show and check if the calculated custom field value in ticket.custom_fields is present as expected.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.