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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Jira behaviour script for priority change



How do i define a script in behavior field,

1)which should be executed only during the EDIT screen,

2)if priority is changed from major to minor, it should add comment in ticket " Priority changed from major to minor"


Plz help with the script 

1 answer

0 votes
Fazila Ashraf Community Leader Nov 19, 2020

Hi @Sharadkumar Bangera 


1) You can check the action as in and then execute the operation only for edits

2) Adding automated comment should be handled via listener or postfunction. Behaviour ideally updates the form fields in the screen and is stored in jira only when the user presses the click buttons to go forward. That said, you can set the comment field text to a certain text using behaviours (more like a suggestive text which user can even edit before save)


Refer to for more instructions on the apis

Thanks Fazila,

I m using Listener but what should be the scrpirt to add comment in listener when the priority is changed




I am Working in  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 using below script but  it require a correction. Please help me where do i define the priority and comment "Priorities changed from Major to Minor".


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 issue = event.issue
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def cf = customFieldManager.getCustomFieldObjectByName("SomeDate")
def sd= cf.getValue(issue) as Date
def someDate = sd.format("yyyy-MM-dd")

String comment = "*Automatic comment:* SomeDate was updated to " + someDate

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Single User Picker CF"}

if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"




Suggest an answer

Log in or Sign up to answer

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