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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script listener script for priorities change



I am looking for Listener custom Script for my query whenever the Priorities change the Comment to be added in Jira "Priorities changed from Major to Minor".I am not good in scripting.

I m writing script listener- Fires an event when condition is true but  endup with error.

Selected Project : All Project

Event : Prioriy changed

Name of the event to fire : Priority changed


This is my script 
import groovy.xml.MarkupBuilder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.model.ChangeGroup
import com.atlassian.jira.model.ChangeItem
import com.atlassian.jira.issue.history.ChangeItemBean

def commentManager = ComponentAccessor.getCommentManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def priorityChange = changelog?.items.find { it['field'] == 'priority' }
def issue = event.issue
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
if (!priorityChange) {"Priority was not updated")
}"Priority changed from {} to {}", priorityChange.fromString, priorityChange.toString)



Error i received

The script could not be compiled:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script387.groovy: 17: unexpected char: 0xFFFF @ line 17, column 102.
   , priorityChange.toString)    

1 error


1 answer

Hi @Sharadkumar Bangera ,

I believe your question has been answered.

To the benefit of those that might come across your post. Here is the link to the accepted answer :

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

177 views 3 14
Read article

Community Events

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

Events near you