Missed Team ’24? Catch up on announcements here.

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

how to set a group picker customfield in a post-function

ltyphair February 28, 2012

How do I set a group picker customfield in a post-function?

CustomField groupField = customFieldManager.getCustomFieldObjectByName("Responsible Group");

Group groupValue = userUtil.getGroup("QA");

issueObject.setCustomFieldValue(groupField, groupValue);

I have tried other things but can not seem to get it right. I am developing on JIRA 4.4.4

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Mizan
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.
February 28, 2012

Hi ,

You should update the value of the customfield "groupField" . try the below code in your postfunction for updating the value of groupField

CustomField customField = customFieldManager.getCustomFieldObjectByName( "Responsible Group" );

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
Group groupValue = userUtil.getGroup("QA");
//Update the custom field value
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), groupValue),changeHolder);

0 votes
tousifs
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.
February 28, 2012

Hi ltyphair ,

CustomField groupField = customFieldManager.getCustomFieldObjectByName("Responsible Group");

Iterate the user

List<Group> groupValue;

List groups = user.getGroups();

for (String group : groups) {
if ("QA".equals(group)) {
groupValue.add(user)
}

issueObject.setCustomFieldValue(groupField, groupValue);

this way you could get the group of type QA for matching user. now you can set value to your custom field.

TAGS
AUG Leaders

Atlassian Community Events