Hi,
I am building a report to retrieve the “Flagged” history of issues. I need to display the status of the issue when it got flagged for the first time. Any idea on how to do it?
Thanks
Hi,
I am building a report to retrieve the “Flagged” history of issues. I need to display the status of the issue when it got flagged for the first time. Any idea on how to do it?
Thanks
Hi,
The solution for this use case is to create the Javascript calculated custom field in eazyBI.
I tried the following settings for that which seems working fine:
[jira.customfield_status_flagged]
name = "Status First Flagged"
data_type="string"
dimension = true
javascript_code='''
var initial_status=true;
var was_flagged=false;
var current_status=null;
for (i=0; i<issue.changelog.histories.length;i++) {
history = issue.changelog.histories[i];
for (j=0;j<history.items.length;j++) {
historyItem=history.items[j];
if (historyItem.field=="status") {
if (initial_status && was_flagged) {result=historyItem.fromString;initial_status=false;break;}
initial_status=false;
current_status=historyItem.toString;
}
if (historyItem.field == "Flagged") {
was_flagged=true;
if (!initial_status) {result=current_status;break;}
}
};
};
if (initial_status && was_flagged) {result=issue.fields.status.name};
if (was_flagged) {issue.fields.customfield_status_flagged=result;}
Note that you need to import this field as a new custom dimension from the custom field list. Please, contact support, if this code needs some fine-tuning.
Kindly,
Janis, eazyBI support