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 cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events