Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Status count in jira using script runner

Abhishree Nagesh
Contributor
November 19, 2018

Hai,

How to count the number of times that the issues comes to the same status in script runner for jira or using groovy script.

1 answer

0 votes
Tom Lister
Community Champion
November 19, 2018

Hi @Abhishree Nagesh

You could create a custom field to record number of transitions and increment it in transitions to the required status.

Finding workflow steps in history is more involved.

You will need to go through the Change History looking for changes in status. You will need to check old and new values to identify a particular transition.

 

List<Issue> issues = new ArrayList<Issue>();

issues.add(currentIssue);

List<String> fields = new ArrayList<String>();

fields.add("status");

// fields.add("Status");

List<ChangeHistory> transHist = chgManager.getChangeItemsWithFieldsForIssues(issues, fields);

for (ChangeHistory change : transHist) {

List<ChangeItemBean> cha = change.getChangeItemBeans();

for (ChangeItemBean item : cha) {

if (item.getField().equals("status")) {

UserHistoryEvent event = new UserHistoryEvent(change.getAuthorDisplayName(),

change.getTimePerformed(), "Transition", change.getId());

addEvent(event, event.eventDate);

}

}

}

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira service management, jsm webinar, ai in jsm, opsgenie integration, incident management, virtual agent, atlassian intelligence, ai-powered service desk, it operations, atlassian learning, service management webinar, team '25 recap

What’s new in Jira Service Management 🤔

Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.

Register here ⬇️
AUG Leaders

Atlassian Community Events