Shared code JavaScript customfields

Petr,

There IS a possibility to share the code among the custom fields.

You can create a new section in the advanced settings like this:

[jira]
common_javascript_code = '''

// change data type to number
function setNumber(str)
{
  num = Number(str);
  if ( Object.prototype.toString.call(num) === "[object Number]" && !isNaN( num )) {
    return num;
  }
  else {
    return null;
  }
}
'''

Now the function setNumber is available in any of your Javascript custom fields.

Kindly,
Janis, eazyBI support

1 Like