Prerequisites:
Let's say you track tasks in an Elements Checklist panel and you want to list users that needs to take an action in a user field:
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 import com.atlassian.jira.user.ApplicationUser 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 userManager = ComponentAccessor.getUserManager() def panelContentService = ComponentAccessor.getOSGiComponentInstanceOfType(panelContentServiceClass) // Constants to customize def PANEL_NAME = "Tasks" def CHECKBOX_ATTRIBUTE = "Done" def USER_ATTRIBUTE = "Owner" // Define Elements panel def elementsPanel = panelContentService.getPanel(issue, panelRefClass.byName(PANEL_NAME)) // Get Elements panel items Set<ApplicationUser> usersSet = new HashSet<ApplicationUser>() for (def panelItem : elementsPanel.getPanelItems()) { def taskDone = panelItem.getAttributeContent(attributeRefClass.byName(CHECKBOX_ATTRIBUTE))?.getValue() if(!taskDone) { def owner = panelItem.getAttributeContent(attributeRefClass.byName(USER_ATTRIBUTE))?.getValue() if(owner != null) { usersSet.add(userManager.getUserByName(owner)) } } } return usersSet
Notes:
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.