I have a requirement to automatically populate a custom field during a particular workflow transition. This field is called "Owner" and should be populated with the name of the asignee.
I am new to scripting post functions, so as a first step, I tried the following code to attempt to populate that field with a test string. The workflow transition works, I see no errors, but the field remains empty.
import com.atlassian.jira.bc.issue.search.SearchService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.web.bean.PagerFilter;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
ComponentManager componentManager = ComponentManager.getInstance();
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();
CustomField cfOwner = customFieldManager.getCustomFieldObjectByName("Owner"); IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
cfOwner.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customFieldTarget), "Test"), changeHolder);
I would appreciate assistance to determine what I am doing wrong.

