hey,
im trying to make a new issue out of a workflow-transaction via scriptrunner -> clone an issue an link. atm - it works perfect.
but i want to add some more fields to the new issue.
i can define the summary (issue.summary) and i can fill the description.
but i have problems with issue.components (and issue.versions). i get errors trying
issue.components = "Component 1" -> cannot cast string to collection
issue.components = "1" -> cannot cast integer to collection
i see the problem - but whats the right way to fill the collection?
*thx*
Hello,
Try like this:
import com.atlassian.jira.component.ComponentAccessor
def component = ComponentAccessor.getProjectComponentManager().findByComponentName(issue.getProjectId(), "Component 1")
issue.setComponent([component])
Hey, another error
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.setComponent() is applicable for argument types: (java.util.ArrayList)
when i try setComponents[component] - i get the same error i got after Marks answer
com.atlassian.jira.bc.project.component.ProjectComponentImpl cannot be cast to org.ofbiz.core.entity.GenericValue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kindly make changes to the script like this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()def missue = ComponentAccessor.getIssueManager().getIssueObject(issue.getKey()
)
def component = ComponentAccessor.getProjectComponentManager().findByComponentName(missue.getProjectId(), "Component 1")
issue.setComponent([component])
ComponentAccessor.getIssueManager().updateIssue(user, missue, EventDispatchOption.ISSUE_UPDATED, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
now the error is
java.lang.String cannot be cast to org.ofbiz.core.entity.GenericValue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.