I want to use two custom fields.
If you use the first custom field in the second custom fieldd, the wrong value appears.
Is there an order between custom fields?
This is the setting I want to use.
[jira.customfield_hdElapsedTime]
measure = true
data_type = "integer"
javascript_code = '''
var total = 0;
if(issue.fields.customfield_10301) {
var times = issue.fields.customfield_10301.completeCycles;
for (var i in issue.fields.customfield_10301.completeCycles) {
if (issue.fields.customfield_10301.completeCycles[i].elapsedTime) {
total += issue.fields.customfield_10301.completeCycles[i].elapsedTime;
}
}
issue.fields.customfield_hdElapsedTime = total;
} else {
issue.fields.customfield_hdElapsedTime = 0;
}
'''
[jira.customfield_hdDueyn]
dimension = true
data_type = "string"
javascript_code = '''
if(issue.fields.customfield_hdElapsedTime) {
if(issue.fields.customfield_hdType == "L1") {
if (issue.fields.customfield_hdElapsedTime <= 28800000) {
issue.fields.customfield_hdDueyn = "Y";
} else {
issue.fields.customfield_hdDueyn = "N";
}
} else if (issue.fields.customfield_hdType == "L2") {
if (issue.fields.customfield_hdElapsedTime <= 86400000) {
issue.fields.customfield_hdDueyn = "Y";
} else {
issue.fields.customfield_hdDueyn = "N";
}
}
} else {
issue.fields.customfield_hdDueyn = "N/A";
}
'''
Hi,
The order of the execution of JavaScripts for custom field calculations is not defined.
We recommend avoiding reference from one JavaScript calculated custom field to another as it can give an unpredictable result. You would like to use all necessary calculations within a JavaScript calculated custom field relying on JIRA issue data only to get correct results.
Regards,
Zane / support@eazybi.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.