How to assign custom field value to a single user picker?

I am trying to update the values of a few fields when an issue is edited in certain statuses. The text fields that I need to update are pretty straight forward and are getting updated. However I have a couple of single user pickers which I am unable to set. The source fields are database custom fields (using Power Database Fields). Below is the code I am currently using. Please help me understand where I am going wrong.

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor

def issue               = event.issue as Issue;
def customFieldManager  = ComponentAccessor.getCustomFieldManager();
def issueStatus         = issue.getStatus().name;

if(issueStatus == 'status1' || issueStatus == 'status2')
    def userPicker1     = customFieldManager.getCustomFieldObjects(event.issue).find { == 'Dev Engineer'};
    def userPicker2     = customFieldManager.getCustomFieldObjects(event.issue).find { == 'Test Responsible'};
    def textField1      = customFieldManager.getCustomFieldObjects(event.issue).find { == 'Test Case'};
    def dbFieldValue1   = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjects(event.issue).find { == 'Database Field 1'});
    def dbFieldValue2   = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjects(event.issue).find { == 'Database Field 2'});
    def dbFieldValue3   = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjects(event.issue).find { == 'Database Field 3'});

    def changeHolder    = new DefaultIssueChangeHolder();
    userPicker1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(userPicker1), dbFieldValue1),changeHolder);
    userPicker2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(userPicker2), dbFieldValue2),changeHolder);
    textField1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(textField1), dbFieldValue3),changeHolder);

We are using JIRA Software version 7.3.6.

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

734 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you