You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
How do i define a script in Listener - 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"
Please provide the script if there is any , i already refer various google answer but it failed when i implemnted it
Script which i used and it is incomplete, kindly help me with above requirement
I used Listener- Field
import com.atlassian.jira.component.ComponentAccessor
issue.priority?.name == 'Blocker'
issue.summary == 'Priority is changed'
1)which should be executed only during the EDIT screen,
Script Listener is designed to work based on the Events - that means the Listener would not know if the action was done on the screen or inline edit or REST API calls.
2)if priority is changed from major to minor, it should add comment in ticket " Priority changed from major to minor"
def field = event.getChangeLog().getRelated('ChildChangeItem').find{it.field == "Priority"}; def old_field_value = field.oldstring; def new_field_value = field.newstring;
if (old_field_value == "Major" && new_field_value == "Minor") {
do something here
}
import com.atlassian.jira.component.ComponentAccessor
def commentManager = ComponentAccessor.getCommentManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
if (old_field_value == "Major" && new_field_value == "Minor") {
commentManager.create(
issue,
user,
"Priority changed from Major to Minor",
false)
}
Disclaimer: I have not tested the code above. These are all from a very old script that I have before.
Thanks,
Moga
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.