Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Want to capture first and later reassignments to a group in a scripted field.


This field was created to count the no of time the ticket was assigned to a group AA Service Desk. first assignment on creation is not getting captured, later changes are getting captured. What changes will be required here?

Whenever it is first assigned to this group on creation through automation or being preset as a value. It is not captured as a count. It is showing 0. It should count that as 1 and later routing to that group also.

This is the script written for a number field template scripted field but what changes will be required here to achieve the objective.

import com.atlassian.jira.component.ComponentAccessor
def data = 0

for(def his : ComponentAccessor.getChangeHistoryManager().getChangeItemsForField(issue, "Group Assignee")){
if (his.toString == "[AA Service Desk]"){
data = data +1

return data


Kindly advise.



Muddassir Quazi

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 17, 2021

You can make a logical assumption here - the creation of an issue is not recorded as a change, but the data is (would be) that all fields changed from "not there" to "their initial state".  Humans infer that logic instinctively and so Jira wasn't really built to store or provide that data directly.

You'll need to code to make the assumption, but it's not hard, you can make the assumption that "if no changes are found in the history, the current value of the field is what was set at the beginning".

However, your code is simply counting the number of changes.  Logically, you could just add 1 to "data" to count the change from "not there" to "initial value".

The question there is whether you want to count that differently depending on the initial value.  I suspect you've got two cases to count differently:

  • If the initial value was <anything> count "not there" to "<anything>" as a change
  • If the initial value was not set, do NOT count "not there" to "not set"

You'll need to amend your code so that it looks at the initial value set, either as it iterates through the changes (look at the initial value in the very first change found), or if no changes have happened since the creation, what the current value of the field is.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events