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
Community moderators have prevented the ability to post new answers.
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);
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.
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.