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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Priority change manualy



I am looking for a option whenever the priorities field changed manually from Incident, Project "SMXBID"the Comment to be added automatically ""Priorities changed from Minor to Major" in Jira

I attached screendump , kindly see if i am using correct EVENT and also see below script where i get error message and no comment is added while executing.

Please assist my script , remeber it should add comment Old value to new value (""Priorities changed from Minor(old value) to Major"(new value) )


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.priority.Priority
issue.projectObject.key == 'SMXBID' == 'Incident'
// Check if priority changeddef customFieldManager = ComponentAccessor.getCustomFieldManager()
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find

{it.field == "priority"}

if (change) {
log.warn "Priority Changed" 
log.warn "Priority remain same" 


1 answer

0 votes
Jia Jie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Feb 02, 2021

Hi Sharadkumar,

Priority field is a Jira system field and therefore, CustomFieldUpdatedEvent is not available for this case.

You should get the Priority's old value and new value then set the comment:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.priority.Priority
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.type.EventType

def issue = event.issue

def issueType =
//log.warn issueType

def commentManager = ComponentAccessor.getCommentManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// Check if priority changed
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find{it.field == "priority"}

if(issueType == "Story"){ //If the issue type is "Story"
if (change) { //If the changed field is Priority field
def oldP = change.oldstring //Get the Priority's old value
def newP = //Get the Priority's new value
log.warn "Priority Changed from $oldP to $newP."

//Add comment
"Priority Changed from $oldP to $newP.",

log.warn "Priority remain same"

You can select the Project(s) field with your project: "SMXBID" and Issue Updated event.

Hope this helps!

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events