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:
You want to get your panel content and display it in the issue navigator:
You can use the following script in a script field:
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;