Grid List



Grid List
import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.JiraAuthenticationContext import com.atlassian.plugin.PluginAccessor import com.atlassian.jira.user.ApplicationUser // get current user JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getOSGiComponentInstanceOfType(JiraAuthenticationContext.class); Object userObject = jiraAuthenticationContext.getLoggedInUser(); User user = userObject instanceof ApplicationUser ? ((ApplicationUser) userObject).getDirectoryUser() : (User) userObject; // find TGE custom fields PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor(); Class tgeConfigManagerClass = pluginAccessor.getClassLoader().findClass("com.idalko.jira.plugins.igrid.api.config.grid.TGEGridConfigManager"); def tgeConfigManager = ComponentAccessor.getOSGiComponentInstanceOfType(tgeConfigManagerClass); List tgeCustomFields = tgeConfigManager.getGridList(user); StringBuilder result = new StringBuilder(); result.append(tgeCustomFields.size() + " TGE fields found:\n"); for (def tgeField : tgeCustomFields) { result.append(String.format("-[%d:%s]\n", tgeField.getId(), tgeField.getName())); } println(result.toString()); return result.toString();