Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Scriptrunner Rest-Endpoint; Custom-Field causes StackOverflowError Edited


we have a scriptrunner custom endpoint which returns our worklogs and worklog-issue-data. as soons as we start to add customfield-informations our script crashes and returns:


we tried to fire this script in the scriptrunner cosnole but we are not running into any errors there. did anyone experience similiar issues or might have a solotion to this?

this is the full script:

import groovy.json.JsonBuilder
import groovy.transform.BaseScript


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.worklog.Worklog

@BaseScript CustomEndpointDelegate delegate

getIssueWorklogs(httpMethod: "GET", groups: []) { MultivaluedMap queryParams, String body ->

def worklogs = getAllWorklogs()

return Response.ok(new JsonBuilder(worklogs).toString()).build();

def getAllWorklogs(){
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issueManager = ComponentAccessor.getIssueManager()
ApplicationUser user = ComponentAccessor.getUserManager()getUserByName("sth")
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfKunde = customFieldManager.getCustomFieldObject(10325)
def workLogManager = ComponentAccessor.getWorklogManager()

def query = jqlQueryParser.parseQuery("project = sth")
def results =, user, PagerFilter.getUnlimitedFilter())
log.warn("Total issues: ${}")

def issueWorklogs = [:]

results.getIssues().each {documentIssue ->

// if you need a mutable issue you can do:
def issue = issueManager.getIssueObject( // TODO handle exception

//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)

def worklogAuthor = "N/A"
def worklogTimeSpentInMinutes = "N/A"
def worklogCreatedDate = "N/A"

if(logsForIssue.size() > 0){
def worklogs = []

def assignee
if(issue.getAssigneeUser() == null){
assignee = "unassigned"
} else {
assignee = issue.getAssigneeUser().getDisplayName()

def cfKundenValue = issue.getCustomFieldValue(cfKunde) //ADDING THIS CAUSES CRASH

for(Worklog worklog : logsForIssue ){
worklogAuthor = worklog.getAuthorObject().getDisplayName()
worklogTimeSpentInMinutes = worklog.getTimeSpent()/60
worklogCreatedDate = worklog.getCreated().toString()

def worklogContent = [
'Issue key': issue.getKey(),
'Issue Type': issue.getIssueType().getName(),
'Status': issue.getStatus().getName(),
'Summary, ': issue.getSummary(),
'Project key': issue.getProjectObject().getKey(),
//'Project name': issue.,
//'Project lead': issue.,
'Kunde': cfKundenValue,
'Assignee': assignee,
'Created': issue.getCreated(),
'Updated': issue.getUpdated(),
'Due Date': issue.getDueDate(),
'Original Estimate': issue.getOriginalEstimate(),
'Time Spent in s': issue.getTimeSpent(),
"WorkLogCreatedDate": worklogCreatedDate,
"WorkLogAuthor": worklogAuthor,
"WorkLogTimeSpentInMinutes": worklogTimeSpentInMinutes,
issueWorklogs.put(issue.getKey(), worklogs)
return issueWorklogs


1 answer

0 votes

Hi @Falk Pietsch 

This statement

def cfKunde = customFieldManager.getCustomFieldObject(10325)

I would expect to be

def cfKunde = customFieldManager.getCustomFieldObject("customfield_10325")


Next i would log the value returned by issue.getCustomFieldValue to check its returned.

Could also put a try/catch block around the statement to catch any unchecked exceptions.

Are there any permissions issue to do with the field? Are the callers of the rest endpoint permission differently to yourselves running in the console.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Trello

📹 Favorite Trello templates

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. In this video, I'll share my favorite Trello templates. Templates mentioned in ...

99 views 5 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