All eazyBI for Jira eazyBI for Confluence Private eazyBI

Status category change week

Import the Status Category Change week in eazyBI for Jira Cloud. The Javascript code returns a week start date. The number 5  in the custom JavaScript code is the day number for the starting day of the week. In the example, it is Friday (5). If you want your week to begin on Tuesday, use 2 instead.

Some default Jira fields are returned in the JSON view but can't be used by default when calculating other calculated fields using JavaScript. In such cases, the additional line json_fields = ["JiraFieldID"]   should be used in the advanced settings to access the field during data import.

Account-specific calculated field

Account specific calculated fields are defined in Source Data → Import options.

Settings for the new field

Internal name

stcatchweek

Display nameStatus Category Change Week
Data type

string 

Dimension

Additional advanced settings
json_fields = ["statuscategorychangedate"] #this line is mandatory

Custom JavaScript code:

if (issue.fields.hasOwnProperty("statuscategorychangedate")) {
  var sccd = new Date(Date.parse(issue.fields.statuscategorychangedate));
  sccd.setDate(sccd.getDate() - ((sccd.getDay() - 5 + 7) % 7));
  return sccd.toISOString().substr(0, 10);
}

Global calculated field

Global calculated fields are defined in eazyBI advanced settings.

Here are the settings for the new field definitions. You should insert the JavaScript (the code given above) below the line // Insert here the Custom JavaScript codeKeep the opening and closing quotation marks. ''', do not delete them.

[jira.customfield_stcatchweek]
name = "Status Category Change week"
data_type = "string"
dimension = true
json_fields = ["statuscategorychangedate"] #this line is mandatory
javascript_code = '''
   // Insert here the Custom JavaScript code 
'''