I’ve a case where, in a project there are
- some issues with label 1
- some issues with label 1 & label 2
- some issues with label 1, label 2 & label 3
My requirement is,
any issue that has - only label 1 and not label 2 & label 3 should count under scenario 1
- label 1 & label 2 and not label 3 should count under scenario 2 (#1 shouldn’t be counted here)
- label 1, label 2 & label 3 should count under scenario 3. (#1 & #2 shouldn’t be counted here)
For this, Getting a count of a specific issue type that has a combination of labels,
I modified code from the above link as below:
[jira.customfield_sc]
name = “Scenario”
data_type = “string”
dimension = true
javascript_code = ‘’’
var label1 = "fail_rev_1";
var label2 = "fail_rev_2";
var label3 = "fail_rev_3";
var label = issue.fields.labels;
if(label){
if (label.indexOf(label1) != -1 &&
label.indexOf(label2) = -1 &&
label.indexOf(label3 = -1))
{
issue.fields.customfield_sc = "Scenario1";
}
if (label.indexOf(label1) != -1 &&
label.indexOf(label2) != -1 &&
label.indexOf(label3) = -1)
{
issue.fields.customfield_sc = "Scenario2";
}
if (label.indexOf(label1) != -1 &&
label.indexOf(label2) != -1 &&
label.indexOf(label3) != -1)
{
issue.fields.customfield_sc = "Scenario3";
}
};
'''
After saving the above code in settings, and selecting the scenario custom field in import options and attempting to import,
I get this error: Execution of custom JavaScript code raised the following error:
Invalid assignment left-hand side.