Forums

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

how to copy value from assignee to group picker

Anish Nizar March 11, 2018

how  to copy value  from assignee value  to group picker

1 answer

0 votes
Alexey Matveev
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.
March 11, 2018

You can not copy assignee value to a group picker, because assignee is of the ApplicationUser type and group picker is of the Group type.

Anish Nizar March 11, 2018

any other way have to auto populate the user's group value to group picker

Alexey Matveev
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.
March 12, 2018

Do you want to populate a group of an assignee to a group picker? And what if an assignee belongs to multiple groups?

That is how you populate a group picker

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def groupManager = ComponentAccessor.getGroupManager()

def multiGroupCf = customFieldManager.getCustomFieldObjectByName("multigrouppicker")
def singleGroupCf = customFieldManager.getCustomFieldObjectByName("GroupPicker")

def group = groupManager.getGroup("jira-developers")

issue.setCustomFieldValue(multiGroupCf, [group])
issue.setCustomFieldValue(singleGroupCf, [group])

And you can get a group of an assignee like this

def groups = ComponentAccessor.getGroupManager().getGroupNamesForUser(issue.getAssignee().getName())

Anish Nizar March 12, 2018

how to run this script in jira because i am new to jira.

Alexey Matveev
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.
March 12, 2018

You need a plugin. The scripts, which I provided, can be run by ScriptRunner. You can also use Power Scripts add-on. But there will be a different script.  The script will be easier.

Anish Nizar March 12, 2018

Thanks Alexey.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events