Create
cancel
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

When I use the API setFieldOptions(...) for a Custom Version Picker Field - previous value is delete

I have a custom field of type Version Picket (multiple values).

I have a behaviour that initiate the options for this field (for example when you edit the ticket).

The possible options for that field are versions from another Jira project - this is working fine.

The problem is when you have value in this field and edit the ticket again - the previous value of the field is being deleted.

Why?

1 answer

Hi @Eran Flom

Could you please specify which version of ScriptRunner you are using when testing this?

Also, could you please share your behaviour configuration and code for better understanding?

Thank you and Kind Regards,

Ram

I am using Adaptavist ScriptRunner for JIRA version 6.41.0 (on a Jira server v8.16.0)

 

The behaviour is set with all the default values (Use Validator Plugin is unchecked and there is no Guide workflow).

The code is in the Initialiser (to be activated when the edit screen is entered). This is the code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.VersionManager
import com.atlassian.jira.project.version.Version

// Specify the master project - to get the versions from
def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectObjByName("Proj A")

// Get all the vesrions from "Proj A"
def versionManager = ComponentAccessor.getVersionManager()
def List<Version> versions = versionManager.getVersions(project)

def versionOptionsFld = getFieldByName("Version Picker Field Name")
versionOptionsFld.setFieldOptions(versions)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

394 views 19 22
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