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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,854
Community Members
 
Community Events
184
Community Groups

How to get the name of the project category?

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?

1 answer

1 vote
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2016

You can use script runner plugin to  fetch the value and then update the custom field

ProjectCategory
getProjectCategoryForProject(Project project)

https://developer.atlassian.com/static/javadoc/jira/latest/reference/com/atlassian/jira/project/ProjectManager.html

Thanks. I tried that, but I get always the same error: 

image2016-8-5 16:34:44.png

 

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2016

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.

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?

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2016

Yes, just import the class, it's easy, look up the api in the link i shared.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2016
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

Juan José Marchal Gómez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 09, 2020

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)

Like Danila Bystrov likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events