Hello,
Not very familiar with groovy, but managed to get some things wroking. Unformtunately I have an issue with copying single user picker value to multi user picker value. Trying to do that for some time, but with no success so at the moment as workaround I'm just copying single to single.
Here is the current code for single to single copying, as a workarounf
...some code...
def cfMultiUser1 = customFieldManager.getCustomFieldObjectByName(field);
log.info("username2 ${field}")
log.info("username3 ${cfMultiUser1.toString()}")
def cfMultiUser1Value = issue.getCustomFieldValue(cfMultiUser1)
log.info("nazwa1 ${cfMultiUser1Value.toString()}")
def cfMultiUser2Value = issue.getCustomFieldValue(cfMultiUser2)
cfMultiUser2.updateValue(null, issue, new ModifiedValue(cfMultiUser2Value, cfMultiUser1Value),changeHolder);
issueManager.updateIssue(user,issue,EventDispatchOption.ISSUE_UPDATED,true);
it is working, but when trying to use multi user picker as the destination field always get some issues, or the value is just empty.
I was trying to put the user from first filed into list but it doesn't work. I tried different solutions but all are invalid. One of them is:
List<ApplicationUser> users
users = new ArrayList<>();
users.add(ComponentAccessor.getUserManager().getUserByName(cfMultiUser1Value.toString()))
cfMultiUser2.updateValue(null, issue, new ModifiedValue(cfMultiUser2Value, users),changeHolder);
I'm running jira v. 7.10.2
I will appreciate any suggestions.
Thank you
Blazej