How to get old field value by object (not string) in scriptrunner

Ian Whalen July 21, 2018

My overall goal is to set something up that adds a user as a watcher when they are added to a specific custom field (the custom field is a multi-user picker).

My first pass used the following logic:

def field = event.getChangeLog().getRelated('ChildChangeItem').find{it.field == "field_name"};

def oldList = field.oldstring.tokenize()
def newList = field.newstring.tokenize()

Unfortunately this only returns the users display names, when I ideally want user objects or, if needed, usernames, so that I can easily pass them to the WatcherManager.

Anyone have a suggestion on how I can get do what I want, either by getting the usernames out of the changelog *or* by using some other approach entirely?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events