Is there a way to copy the name of the project category the project of the issue belongs to into a special custom field wihtin a post function?
You can use script runner plugin to fetch the value and then update the custom field
ProjectCategory getProjectCategoryForProject(Project project)
Thanks. I tried that, but I get always the same error:
image2016-8-5 16:34:44.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you used script runner / groovy before?
You need to import the classes, the snippet which I shared with you is from the docs and thus you need to create an instance of the class ProjectCategory and then update the custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I used sript runner and added a groovy scripted field, but I didn't import any classes.
So I guess I first have to figure that out, right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, just import the class, it's easy, look up the api in the link i shared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.jira.project.ProjectManager |
and then create an instance of this class and call the getProjectCategoryForProject(Project project) method and then you can get projectCategory object and get the name of the category
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.component.ComponentAccessor
//Test para Console
def issueKey = "IESD-14862"
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject(issueKey)
//def issue = issue as Issue
log.info("issue: "+ issue)
def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectCategoryForProject(issue.getProjectObject())
log.warn(project.name)
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.