Hi,
I'm pretty new to JIRA and I'm trying to write a script listener where -
Whenever an issue is commented on, or the value of a CF is changed (in genereal, I guess it'll be any issue updated event, correct me if I'm wrong), then I want to get the list of the updated items and look through those items to find a particular string (say, abc.xyz.in).
I tried event handling, but while trying to get the changeLog(), its returning null for me.
Can anyone guide me through how it can be achieved using groovy script listeners ?
Overall, what I want is to update a CF (say, CF1) by looking for a list of strings whenever an issue is updated.
Thanks in advance,
Neha
Hi @Mark Markov,
Shouldn't the changelog "not be null" when I update a comment ? or add a new comment ?
How can I get the updated comment during this event ?
I tried the thing that you suggested but the changelog is null when I edit a comment.
-Neha
Hello @Neha Sharma
Here is example how you can find changes on Release Date field.
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Release Date"}
log.error("all changes : "+ event?.getChangeLog()?.getRelated("ChildChangeItem"))
if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
// your actions if the field has changed
}
So
event?.getChangeLog()?.getRelated("ChildChangeItem")
contains all field changes during event. Try to add this listener on Issue Update and see logs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script above shows you updated fields. If you need comment that was added during event, you can get it like this
def comment = event?.getComment()?.getBody()
if (comment) {
log.error "Comment body ${comment}"
// your actions if the field has changed
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.