Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to copy all versions from a multi-version picker custom field to Fix Versions


I want to copy FixVersion/s field to custom field Fix Version (Single version picker).

I assisted by this post and rewrite the script mentioned in here:  (Jeremy code).

when i running this code on the script console in script runner i get the next error:

2018-04-17 12:53:56,645 WARN [common.UserScriptEndpoint]: Script console script failed: java.lang.NullPointerException: Cannot invoke method getId() on null object at

what am I missing here?

This is the code:

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.Version;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager;
import java.util.ArrayList;
import java.util.Collection;

IssueManager issueManager = ComponentAccessor.getIssueManager();
ProjectManager projectManager = ComponentAccessor.getProjectManager();
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField nvcf = customFieldManager.getCustomFieldObjectByName("Fix Version"); // Fix Version Custom Field

Project project = projectManager.getProjectByCurrentKey("PROC");
Collection<Long> projectIssueIds = issueManager.getIssueIdsForProject(project.getId());

projectIssueIds.each {
Issue issue = issueManager.getIssueObject(it);
Object fixVersions = issue.getFixVersions();
Object newFieldVersions = issue.getCustomFieldValue(nvcf);
issueManager.updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue, EventDispatchOption.ISSUE_UPDATED, false);


1 answer

The system field 'Fix Version/s' is multi-version.

Try to change your custom field to be Version Picker (multiple versions).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

👁‍🗨 Confluence Team planning dashboard_Atlympics 🌈

Hi Atlassian's, How is your journey with #Atlympics 2021 so far....excited! Me too, same excitement. Here's my typical team planning and vision dashboard which I used to share to my management and ...

99 views 1 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you