I am looking for the groovy script to track the changes of status of an issue. I want to trigger some actions if at all the issue status has been changed.
Can someone please help on the script to track this change?
A listener for this would need to be configured to trap and react to any event fired by your transistions, which might be a bit of a manual slog to work out all of them, but the alternative of putting a post-function into every transition is much worse. In fact, I'd just listen for most events and then check "has status changed in this event"
You've not really said what you want to do with "track this change", but here's a pile of sample listeners for SR that might help you with some of it - https://library.adaptavist.com/search?term=listener
Thanks for your reply.
I am writing this listener , whenever status of an issue is changed , I want to push some values to database.
I am trying to do this with 'changeItem' and so looking for a help on the script line for the status change to be tracked.
Ok, I want to suggest a slightly different approach on a couple of points.
First, an event contains a whole load of information about the action that triggered it, and that's directly available to your listener code, so there's a good chance that you don't need to start messing with reading issues for data you already have in the event.
Second, you mention changeitem, which is the name of a table in a jira database. In a listener, you have direct access to the api, which is a far better way to fetch Jira data than reading the database for raw data. Reading a Jira database is the worst possible way to get data out of a Jira system.
Now, bearing in mind the sequence of things that happen when you're talking about listeners, the bit we're interested in is:
One thing that springs out here is that all the data that is going to go into the changeitem table is also in the event. As well as the rest of the change information that's held in other tables in the database.
So, use the event data in your code, forget the Jira database.
You say you want to "push some values to a database" - that's fine, but what values and what database?
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events