Missed Team ’24? Catch up on announcements here.

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

is there a method to get project leader programmingly in Behaviours Plugin?

fabby June 5, 2012

my jira version is jira 4.4.1

anyone knows which method can get project leader in jira api?

i searched out the jira api,but without result.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jobin Kuruvilla [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 Leaders.
June 5, 2012
fabby June 5, 2012

i find the method getProjectObject() which can get project object according to issue.but now the problem is how to get the "current issue object"

fabby June 5, 2012

hi Jobin,

i want to get curent project id according to the issue.for example how to get current project when i resolve an issue

fabby June 5, 2012

i've get it,

import com.opensymphony.user.User
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager
import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project

FormField formField = getFieldById("resolution")
FormField comField = getFieldById("comment")

ComponentManager componentManager=ComponentManager.getInstance()
User user = componentManager.getJiraAuthenticationContext().getUser()
String curruser=user.getFullName()

IssueManager issueManager=componentManager.getIssueManager()
GenericValue issue=issueManager.getIssue("TEEE-5")
def projectid=issue.project
ProjectManager projectManager=componentManager.getProjectManager()
Project project=projectManager.getProjectObj(projectid)
def projectlead=project.getLeadUserName()

comField.setFormValue("current user is :"+curruser+" current issue is:"+projectlead)
JamieA
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.
November 8, 2012

This will fail in jira5. If you don't use static typing here you won't have any problems when you upgrade. So instead of "User user" just use "def user", and remove the import for User.

You should think about this... you will upgrade at some time and the last thing you will want is having to revisit all your old code.

0 votes
Srividhya November 8, 2012

hi Jamie,

I am unable to hide a cutom field which is of the type "Checkbox" using Behaviours plugin . My Jira version is jira 4.2.4 .The field is present in both the create and edit screen .What could be going wrong? Its a simple hide function without any condition added or validation added.

Thanks,

Srividhya

JamieA
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.
November 8, 2012

Hello. Not sure why you are answering a completely different question with this?

Srividhya November 11, 2012

Hi Jamie,

I am not answering the question , since you are the developer of the plugin , I just wanted to ask you why the checkbox field is not hidden , when we are saying field.setHidden(true) ?

JamieA
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.
November 11, 2012

Please create a new question including all relevant info.

0 votes
Srividhya November 8, 2012

try this

def issueId = formContents["id"]

def issue = componentManager.getIssueManager().getIssueObject(issueId as Long)

This will fetch "Issue " Object

JamieA
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.
November 8, 2012

Easier to use getUnderlyingIsse() which will fetch the issue object.

TAGS
AUG Leaders

Atlassian Community Events