Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How can i get the original value of a CUSTOM field using Jira Behaviors? Edited


Can someone provide some code snippet for Jira Behaviors plugin that shows how to retrieve the original value of a custom field?

I need to compare against the original value to see if the field has been changed and take some action if necessary.





3 answers

Does this need to be accomplished with behaviours? It sounds like this would be more suited to be done in a listener. For example, you can make a listener that fires on an Issue Created or Issue Updated Event (or all Issue Events). If someone updated the Priority field, check to see what the original value was and what it was changed to. Then, you can perform additional actions based off that information.

def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find{ it.field=='priority' }
if (change) {
def oldValue = change.oldstring
def newValue = change.newstring
log.debug ("Value changed from ${oldValue} to ${newValue}")

// your actions if the field has changed

Log statement:

DEBUG admin [onresolve.scriptrunner.runner.ScriptRunnerImpl] Value changed from Low to High


The requirement is to make the Comment field mandatory if the user changes the custom field.

Aren't Listeners a bit too after-the-fact for my requirements?



Yes, you're correct that listeners wouldn't be very useful in that case. However, your question seemed focus on getting the specific value before and after the field was changed. I don't see why that would be needed if all you want to do is make the comment field mandatory based on a custom field value.

You'd just need a behaviour that would continually check the value of the custom field. It would run on the Create Issue, Update/Edit Issue, Assign Issue, and Workflow Transition screens. If it sees that the custom field has the wrong value, make the comment field mandatory.

def customField = getFieldByName('YourCustomFieldName')
def commentField = getFieldById("comment")

if (customField.getValue() != "Some value") {
else {

If the user changes the custom field to something it's not supposed to be, make the comment field required. Else, don't make the comment field required.

We have a custom field that is a pull-down, so the user can only choose from one of the provided choices.

I need to know if the user selected a different choice of this custom field.  If so, make the Comment field mandatory when the user clicks on "Edit" and changes that custom field.  The Comment field would then be required before the user can click on "Update" to save.

Hi Andrew,

For example:

  • Select List has values A, B, C
  • A is the correct value.
  • If the user clicks "Edit" and changes the custom field and chooses B or C, the comment field will be required.
  • The user will not be able to click "Update" until they provide a comment.
def customField = getFieldByName('YourCustomFieldName')
def commentField = getFieldById("comment")

if (customField.getValue() != "A") {
commentField.setRequired(true) //if the user selects B or C as a choice, make the comment field required
else {
commentField.setRequired(false) //if the user does not select B or C, the comment field will not be required

Does the logic here match what you're trying to accomplish?


My requirement is i don't care what choice is selected.  Every value is correct.

The Comment field is mandatory for the user to explain why the custom field value was changed.




If I may be so bold,

Why don't you simply create a transition for this?

If this field is required at creation, then put it on the Create and View screens only, and leave it off the Edit screen.

The tranisition could be from all to all, called something like "Update MyField," and you can put this field and the comment field on the screen for this transtion.

Then simply require Comment on the transition using a validator.

Would this cover your requirement?

Thank you for the suggestion, April.

I think this is a bit much for my requirements.

The field is required during Create as well as Edit.



Hi @Joshua Yamdogo _ Adaptavist, how can I revert back the original value if the custom field has set to blank/null in a group picker field?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

195 views 6 7
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