Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Elements Checklist - Export panel content into a scritptrunner script field

I currently  try to get this running:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.plugin.PluginAccessor
import com.atlassian.jira.user.ApplicationUser

import com.valiantys.software.elements.api.content.*;
import com.valiantys.software.elements.api.model.*;

@WithPlugin("com.valiantys.software.elements.api.model")
//@WithPlugin("com.valiantys.software.elements")

//@PluginModule
//PanelContentService panelContentService

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 = "Employee Checklist"
def CHECKBOX_ATTRIBUTE = "Done"
def USER_ATTRIBUTE = "Main responsibility"

// 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

 

 

 

But i always get this error:

The script could not be compiled:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Requested plugin com.valiantys.software.elements.api.model was not installed/enabled, compiling source unit Script836.groovy.

java.lang.Exception: Requested plugin com.valiantys.software.elements.api.model was not installed/enabled, compiling source unit Script836.groovy.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
	at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:74)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)

 

What do i missed?

 

Thanks in advance.

1 answer

1 accepted

2 votes
Answer accepted

Hello Marco,

I'm Cécile, I'm part of the Elements team.

I'd invite you to raise a request on our Support Portal. The Support team will be happy to help you with this configuration.

Kind regards,

Cécile

Solved in the Elements Support Portal. Thanx

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.8.0
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

948 views 2 22
Read article

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