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!


Make Fix Version/s readonly

Hi - I am using Adaptavist for Jira.

On behaviors tab, In my listener, I have a situation where I want to make ''Fix Version/s" field read-only only for the given issue based on certain situation. I tried various things but can't seem to find any solution to it.


Any pointer would be appreciated.

3 answers

1 accepted

Finally got it working.

I was trying to use Listener but in reality the script should be written on Behavior tab of 'Adaptavist for Jira'.


For others, this is how my script looks like.


import java.lang.Double

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import org.apache.log4j.Level

@BaseScript FieldBehaviours fieldBehaviours


final targetCustomFieldName = 'My Custom Field Name'
def customFieldManager = ComponentAccessor.customFieldManager

def issueKey = underlyingIssue.key"From Behaviour - issueKey=="+issueKey)

def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issueKey)

def targetCustomField = customFieldManager.getCustomFieldObjects(issue).find {it.getFieldName() == targetCustomFieldName && it.getCustomFieldType().getName() == "Number Field"}"Found targetCustomField to be updated as $targetCustomField");
def targetFieldValue = issue.getCustomFieldValue(targetCustomField) as Double ?: 0"From Behaviour - targetFieldValue="+targetFieldValue)

def otherCustomField = customFieldManager.getCustomFieldObjects(issue).find { it.getFieldName() == "My Other Custom Field"}"From Behaviour - otherCustomField="+otherCustomField)
def otherCustomFieldValue = issue.getCustomFieldValue(otherCustomField)"From Behaviour - otherCustomFieldValue="+otherCustomFieldValue)

if (targetFieldValue >= getOtherCustomFieldValue(otherCustomFieldValue)) {
getFieldById(IssueFieldConstants.FIX_FOR_VERSIONS).setReadOnly(true)"From Behaviour, FIX_FOR_VERSIONS is non-editable")
} else {
getFieldById(IssueFieldConstants.FIX_FOR_VERSIONS).setReadOnly(false)"From Behaviour, FIX_FOR_VERSIONS is editable")

private Integer getOtherCustomFieldValue(otherCustomFieldValue) {
return 10 // OR whatever


Can anybody guide me on this, please?

0 votes
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 11, 2023

Hi @Naveen Verma 

What's the specific situation you want to make FixVersions read only?


I have a custom field counter that I increment every time a change is made in 'Fix Versions/s'  field. However, if that counter has reached a threshold then I want to make 'Fix Version/s' read-only/disabled only for that Issue.

'Fix Version/s' seems to be system field. If I try to grab it using code like below but getting exception.

import com.atlassian.jira.issue.IssueFieldConstants
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

final String fieldName = "Fix Version"
throws this exception
java.lang.NullPointerException: Cannot invoke method getFieldIdByName() on null object at com.onresolve.jira.groovy.user.FieldBehaviours.getFieldByName(FieldBehaviours.groovy:


I also tried this code which executes successfully but never makes the Fix Version read-only.

        def fixVersionsField = getFieldById("fixVersions")"fixVersionsField="+fixVersionsField)


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events