I have the following ScriptRunner behaviour script for our "Required Reviewers" multiuser custom field:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.UserPropertyManager
import com.atlassian.jira.issue.IssueManager
class SetRequiredReviewers extends com.onresolve.jira.groovy.user.FieldBehaviours
{
def run()
{
IssueManager issueManager = ComponentAccessor.getIssueManager();
def mutableIssue = issueManager.getIssueObject(underlyingIssue.id)
def groupManager = ComponentAccessor.getGroupManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
List<ApplicationUser> reviewMembers = groupManager.getUsersInGroup("Review Board Member")
def reqRevField = customFieldManager.getCustomFieldObjectByName("Required Reviewers")
mutableIssue.setCustomFieldValue(reqRevField, reviewMembers)
}
}
However, it never populates, even though if I do some log debug statements, the users I currently have in the Review Board Member group are being found. There's no errors, either.
I also tried adding just a list of user names, but that didn't work, either.
What am I doing wrong here?
Thanks!
Groovy is based on Java, a good starting point is http://groovy.codehaus.org/. You can directly use the documented Java API of JIRA (see Atlassian API Reference). I think a good way to start ist to look at the examples in the Script Runner documentation and the scripts provided by Script Runner and maybe the Atlassian developer docs.
Henning
For changing the status you have to transition the issue through the workflow. You could use the built-in fast transition postfunction of Script Runner or you can do it on your own like described here. https://developer.atlassian.com/display/JIRADEV/Performing+Issue+Operations
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the script runner panel and try to fetch values from JIRA using the JIRA Api's .
You can try this as your first script . You can start with fetching current user , customfield value for a specific issue , number of issues , Project lead , etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want to write a groovy script in which i need to change the statuts of the issue. can you please tell me how should proceed further
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.