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

Disable Scripted fields (Scriptrunner)

I would like to disable a scripted field instead of deleting it. Is the only way to disable it by deleting the entire script, or getting rid of it in screens /issuetypes etc? Seems a bit cumbersome. 

3 answers

2 accepted

1 vote
Answer accepted

Hi @Howard Nedd , did you try to return null on the first row of your script? It could look like

return null


The script will be always executed so it can have performance impacts.

If you do not want the script to be executed you will need to remove the field from all the Screens -> set them back when you need it.

Hi Martin,


Thank you.

This does not disable the scripted fields right? It will just make it return nothing, right?

So I believe the only option is getting rid of the scripted fields on the screens it is added to.

Hi @Howard Nedd , yeah, it won't disable it, but if a null value is returned, the field should not be displayed on view screen...

1 vote
Answer accepted

"return null" on the first line is the easiest way to "disable" a scripted field.

But I think there is a deeper question here.

Why are you trying to "disable" a scripted field?  What do you get from "disable" that is better than "delete"?

Hi Nic, valid question. 

The fields don't seem to be used right now. They have been added to 2 screens of our entire config and those screens are part of projects that no longer will be used but to make sure I dont mess things up I wanted to disable these fields.

The script itself was also giving out errors  (seems the script did not have an error handler so whenever the script resulted in "Not True" it gave a error). 


So if we do decide to keep this error I will add a the error handler to it but for now I will add return null to the scripts and eventually get rid of them if they are not needed.

How would an error handler look if I wanted to add it to this script?


return null 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.project.Project
import java.text.SimpleDateFormat
import groovy.json.JsonSlurper
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def sprintCf = customFieldManager.getCustomFieldObject(10000)
def sprints = issue.getCustomFieldValue(sprintCf)
//def sprint = sprints.find { !it.isClosed() }
//if (sprint == null)
def sprint = sprints?.last()
getSprintEndDate(issue.projectObject, sprint)

Date getSprintEndDate(Project project, def sprint) {
if (sprint) {
return sprint.endDate.toDate()
} else {
def projectParams = getProjectParameters(, 'sprint_settings')
def sprintSettings = new SprintSettings(projectParams)
String endDate = sprintSettings.getEndDate(
if(endDate) {
return new SimpleDateFormat('yy-MM-dd').parse(endDate)
return null;

Map getProjectParameters(Long projectId, def key) {
try {
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.jiraAuthenticationContext
ProjectPropertyService projectPropertyService = ComponentAccessor.getComponentOfType(ProjectPropertyService.class)
UserManager userManager = ComponentAccessor.userManager

def user = userManager.getUserByName(jiraAuthenticationContext.getLoggedInUser()?.name)
def value = projectPropertyService.getProperty(user, projectId, key)?.entityProperty?.value?.value
if(value) {
def ret = new JsonSlurper().parseText(value)
return ret
return [:]
} catch(Exception e) {
return [:]

class SprintSettings {

private List settings = []

def SprintSettings(Map jsonParameters) {
jsonParameters.settings.each {
settings << [
sprintId: it.sprint_id,
capacity: it.capacity,
startDate: it.start_date,
endDate: it.end_date

List getSettings() {
return settings

boolean contains(Long sprintId) {
return contains(sprintId as String)

boolean contains(String sprintId) {
return (settings.find { it.sprintId == sprintId } != null)

def getCapacity(def sprintId) {
return settings.find { it.sprintId == sprintId as String }?.capacity ?: 0

def getStartDate(def sprintId) {
return settings.find { it.sprintId == sprintId as String }?.startDate ?: ''
def getEndDate(def sprintId) {
return settings.find { it.sprintId == sprintId as String }?.endDate ?: ''

Hi @Howard Nedd ,

Sadly, I don't think there is a possibility to hide/disable the scripted field instead of deleting them.


Hi Kevin, Thank you for getting back at me. I have searched the web and it seems there is no way to simply disable it to do your test, so the remaining option is documenting the script and delete it for now.

Like Kevin Johnson likes this

@Howard Nedd Yea, unfortunately, that's the only option for now.


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