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

Script runner manual.

Greetings. Where I can find information or vocabulary which help me writing scripts in Script Runner? I found a lot of examples but I don't found information about meaning of those scripts.


import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level


//Grab necessary Components
def cfm = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

def clientName = "Acme"
def sourceName = "My Source""clientName: " + clientName)"sourceName: " + sourceName)

//Set custom text field
def cfClient = cfm.getCustomFieldObjectByName("Client")

//Set custom single select field
def customField = cfm.getCustomFieldObjectByName("Source") + " customField before: " + issue.getCustomFieldValue(customField))

def fieldConfig = customField.getRelevantConfig(issue)
def options = optionsManager.getOptions(fieldConfig)
def option = options.find{it.value == "My Source"}

issue.setCustomFieldValue(customField, option) + " customField after: " + issue.getCustomFieldValue(customField))



import com.atlassian.jira.component.ComponentAccessor -  why we importing Comp accessor - and what is it, I have no idea

def customField = cfm.getCustomFieldObjectByName("Source") - def customField...ok, I understood it, but... cfm.getCustomFieldObjectByName("Source")... no idea, where I can find some information about those commands? Mb it's part of Groovy language, I really lost, pls help. Thank you.


1 answer

1 accepted

0 votes
Answer accepted

I think you best start with a groovy tutorial (there are several on the net), then go through the scriptrunner documentation, try to copy and adapt some examples, and finally search specific examples on the net.

(part of) the Jira API can be found at, but this is no cook-book, but a reference guide....

Thx so much. I'll try!

Suggest an answer

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

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

228 views 0 6
Join discussion

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