Jira 7.2.7
Script Runner 5.3.9
I've got a requirement to update a custom user selection field value with a set userid when an issue is cloned. I've figured out the detecting a clone part (a different post helped me out on that). My issue right now is that I can't get this field to update. It appears to be changed, but the value I submit does not get written to the database.
Right now I've got a very dumbed down script that look like this
def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserByName("mwilson")
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11500");
issue.setCustomFieldValue(cf, user)
This generates no errors, but appears to do nothing. "customfield_11500" is a single user selection field.
If I modify the code like this to just update a custom single line text field, it works fine.
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11502");
issue.setCustomFieldValue(cf, "mwilson")
So obviously something special is required here for a user type field. Any ideas what I'm going wrong here?