Can you use Behaviours on Customer Portal Affects Version/s?

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:

image
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?)

image

Does anyone know if this is a general problem at the moment or am I doing something completely wrong?

Thanks in advance!

“unfortunately” im not getting any error response in the logs. Maybe I am misinterpreting the docs.

edit:

i can see my script getting triggered, but it seems like the .setFieldOptions doesnt have any effect.

maybe only an Adaptavist like @jamie.echlin could clarify the situation here =)

If its generally possible to modify the customer portal of a service desk project via behaviours, or just the service desk project itself (inside “normal jira”, without effects on the customer portal).

original conversation here

Additional Console Log Information:

Behaviours is getting the right value, but then exits with an error

Like @tbatagiannis said in the community forum:

Hey @slothstronaut and @Yves Martin ,

There is a known issue for setting values to select lists using service desk behaviours.

Please follow SRJIRA-2687 for updates (I can tell you that there is a Pull Request already so hopefully the fix will be included in the next release)

Regards,

Thanos