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: Table Grid Data returning empty result?


My goal is to read grid data values, however my script is returning an empty grid result even though my grid has values in it. This is the error I'm getting:

"Grid ID 11234 data cannot be retrieved [] Grid ID 11234 content []"

Here is my script:

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.plugin.PluginAccessor
import com.atlassian.jira.user.ApplicationUser

import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.idalko.jira.plugins.igrid.api.config.grid.TGEGridConfigManager
import com.opensymphony.workflow.InvalidInputException

InvalidInputException invalidInputException

TGEGridTableDataManager tgeGridDataManager

TGEGridConfigManager tgeConfigManager
// get an issue
IssueManager issueManager = ComponentAccessor.getOSGiComponentInstanceOfType(IssueManager.class);
Issue issue = issueManager.getIssueObject("TEST-1");

// find TGE custom fields
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor();
Class tgeConfigManagerClass = pluginAccessor.getClassLoader().findClass("com.idalko.jira.plugins.igrid.api.config.grid.TGEGridConfigManager");
tgeConfigManager = ComponentAccessor.getOSGiComponentInstanceOfType(tgeConfigManagerClass);
List<Long> tgeCustomFieldIds = tgeConfigManager.getGridCustomFieldIds();

// get current user
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getOSGiComponentInstanceOfType(JiraAuthenticationContext.class);
Object userObject = jiraAuthenticationContext.getLoggedInUser();
User user = userObject instanceof ApplicationUser ? ((ApplicationUser) userObject).getDirectoryUser() : (User) userObject

// read the grid data
Class dataManagerClass = pluginAccessor.getClassLoader().findClass("");
tgeGridDataManager = ComponentAccessor.getOSGiComponentInstanceOfType(dataManagerClass);

StringBuilder result = new StringBuilder();
for (Long tgeCustomFieldId : tgeCustomFieldIds) {
try {
def callResult = tgeGridDataManager.readGridData(issue.getId(), tgeCustomFieldId, null, null, 0, 10, user);
//result.append("Grid ID=" + tgeCustomFieldId + " content: " + callResult.getValues() + "\n");
String msg = result.append("Grid ID: " + tgeCustomFieldId + " content: " + callResult.getValues() + "\n");
invalidInputException = new InvalidInputException(msg)
throw invalidInputException;
} catch (Exception e) {
String msg2 = result.append("Grid ID=" + tgeCustomFieldId + " data cannot be retrieved: " + e.getMessage() + "\n");
invalidInputException = new InvalidInputException(msg2)
throw invalidInputException;


return result.toString();


0 answers

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