Skip to main content
Skip table of contents

Export panel content into a script field (ScriptRunner)

Prerequisites:

  • ScriptRunner running on your Jira.

Let's say you have the following Elements Checklist panel structure:

List of Tasks Checklist Panel

List of Tasks Checklist Panel

You want to get your panel content and display it in the issue navigator:

Export Checklist panel to a script field in issue navigator

Export Checklist panel to a script field in issue navigator

You can use the following script in a script field:

GROOVY
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.plugin.PluginAccessor;

PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor();
Class panelContentServiceClass = pluginAccessor.getClassLoader().findClass("com.valiantys.software.elements.api.content.PanelContentService");
Class panelRefClass = pluginAccessor.getClassLoader().findClass("com.valiantys.software.elements.api.model.PanelRef");
Class attributeRefClass = pluginAccessor.getClassLoader().findClass("com.valiantys.software.elements.api.model.AttributeRef");

def issueManager = ComponentAccessor.getIssueManager();
def panelContentService = ComponentAccessor.getOSGiComponentInstanceOfType(panelContentServiceClass);

// Define Elements panel
def panelContent = panelContentService.getPanel(issue, panelRefClass.byName("List of tasks"));

// Get Elements panel items
def tab = ""
for (def panelItem : panelContent.getPanelItems()) {
    tab += panelItem .getAttributeContent(attributeRefClass.byName("Task"))?.getValue() + " - ";
    tab += panelItem .getAttributeContent(attributeRefClass.byName("Owner"))?.getValue() + " - ";
    tab += panelItem .getAttributeContent(attributeRefClass.byName("Done"))?.getValue().toString() + "<br/>";
}
return tab;
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.