Hi there!
The goal I’d like to achive, is to only show released and not yet archived versions in the Affects Version/s Field in JIRA Service Desk Customer Portal.
I tried this in vain using the new (and still awesome) Behaviours Service Desk support.
import com.atlassian.jira.component.ComponentAccessor
//getting version Manager
def versionsManager = ComponentAccessor.getVersionManager()//getting the Affects Version/s Field
def versionsField = getFieldById(“versions”)//getting all non-archived released versions
def releasedVersions = versionsManager.getVersionsReleased(issueContext.projectObject.id, false)//setting them as FieldOptions for the Affects Version/s Field
versionsField.setFieldOptions(releasedVersions)
When printing out all versions of this project and the ones in releasedVersions, I get the following result:
REL = only released and non archived versions ( println of releasedVersions.toString()
)
ALL = all versions ( println of versionsManager.getVersions(issueContext.projectObject.id, true)
)
I tried this with and without the BaseScript import at the start of the script, but …
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
… I still got all the versions shown in the customer portal without any error. (What it the BaseScript line doing anyways?)
Does anyone know if this is a general problem at the moment or am I doing something completely wrong?
Thanks in advance!