I have tried it all! I have scoured the interwebs to no avail. I have a project role consisting of multiple users and I need to load those users into a multi-user custom field. The most straightforward way it seems is from a Jira Group instead of project roles, I am good with either. This is the code I have found for the group into custom field.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def groupManager = ComponentAccessor.getGroupManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def myJiraGroup = groupManager.getGroup("Jira Group name") // get the group
def usersInGroup = groupManager.getUsersInGroup(myJiraGroup) // get the users in that group
def myCustomField = customFieldManager.getCustomFieldObjectsByName("Custom multi-user field")
myCustomField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(myCustomField), usersInGroup), new DefaultIssueChangeHolder()) // update myCustomField with users
It throws an error "No signature of method:" but the details get cut off before I can read what parameter is hosed.
TIA