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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

Script listener script for priorities change

Hello,

 

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) {
logger.info("Priority was not updated")
return
}
logger.info("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

Suggest an answer

Log in or Sign up to 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 :
https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Script-listener-to-add-comment/qaq-p/1541445

TAGS
AUG Leaders

Atlassian Community Events