Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add a value in Components part of a project

Deleted user
June 9, 2017

Hi guys, 

I am trying to develop a groovy script (post function) which add a value in Components part of a Project.

I  have the following error :

No signature of method: com.atlassian.jira.ComponentManager.getProjectComponentManager() is applicable for argument types: () values: []

 

create(String name, String description, String lead, long assigneeType, Long projectId)

 I think the problem come from the fourth parameter, I have put 0 because I don't know how to get the right value.

 capture script.PNG

Here is my code : 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.bc.project.component.ProjectComponent
import  com.atlassian.jira.bc.project.component.ProjectComponentManager

OptionsManager optionsManager = ComponentAccessor.getOptionsManager()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
ComponentManager componentManager = ComponentManager.getInstance()

//MutableIssue issue = issue
def issue = ComponentAccessor.getIssueManager().getIssueObject("CTY-213")


def userProjectId = 13900
def component = componentManager.getProjectComponentManager().create("test toto","description","leadtoto",0,userProjectId)

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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 Champions.
September 22, 2011

Hmm. Could you expand on what you mean by "listing of projects with associated scrum teams"?

My best guess is that you want some sort of field at a project level. If so, then you've added "scrum team" to the wrong place, because custom fields in Jira belong to Issues, and not projects (Sadly, there's no implementation of project fields). If I've guessed this correctly, then I'd actually use "category". Set up one category per scrum team, then put each project in the right caregory, and consider removing the scrum team from the issue level.

Zachary Levey
September 22, 2011

I've updated the original question with another example. Hope that makes it more clear!

Nic Brough -Adaptavist-
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 Champions.
September 22, 2011

Mmm, that's a totally different question again. I still think categories answer the original question.

For the question of users, I don't think there is anything to answer it. I believe Jira's user management and reporting has been neglected over the last couple of years and is very weak. Whilst it's possible to create a long rant about it, I really don't want to because I completely understand why - if I were Atlassian, I'd have done exactly the same - the instant they picked up Crowd, user maintenance inside separate applications became a burden and a dead end, and all efforts on user maintenance should be focussed on Crowd

I'm afraid that really doesn't answer your question, it's just my feelings on why it can't be answered and why I'm not blaming Atlassian for weaknesses.

If it were me at your site, I think I'd start looking at writing a plugin to provide a report to cover your user membership reporting.

Zachary Levey
October 2, 2011

While that's what I was afraid of, it does answer my question. It's just too bad as it's really something that a lot of people in our company expected when they saw "Enterprise" in the title.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events