Scriptrunner behaviour, issue type restriction not working when user has other language than default

Manuel Jesús Morión Barea October 3, 2019

Hi, 

In order to restrict issue types on several projects, we have applied the sample code from https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/restricting-issue-types.html

 

The code is next:

 

import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE

def project = issueContext.projectObject

def projectIssueTypes = project.getIssueTypes()
def issueTypeField = getFieldById(ISSUE_TYPE)
def availableIssueTypes = []

def types_list = ["Bug", "Task", "Epic", "Story", "Story Bug", "Test"]

availableIssueTypes.addAll(projectIssueTypes.findAll { (it.name in types_list) })
availableIssueTypes.each { log.error ">>>>>>>"+it.name+" => "+it.id }

issueTypeField.setFieldOptions(availableIssueTypes)

 

It seems to be working, except for users with profile language other than instance default.

For those users, we see the "availableIssueTypes" array has the right info, but something at UI level makes that only "Test" issue type is available in the dropdown menu.

 

Has anybody an idea about a solution for this?

Regards.

1 answer

0 votes
Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2019

Hey Manuel, 

I just tested your script on jira 7.13 and it seems to work, if I change my profile language I get a list of issue types from the behaviour with the translated values. 

Perhaps you could try working with the ID's instead? 

Manuel Jesús Morión Barea October 7, 2019

Hi Tessa, 

 

You'right, I've tested in a fresh installation of 7.9.2 (same versión as the one failing) and it's working ok.

It seems like any kind of corruption on the issue types.

This momment I'm checking the database tables.

 

Regards.

Patrick Gießler April 14, 2020

Hi Manuel,

I have the same problem.

Have you found a solution?

Regards

Patrick

Manuel Jesús Morión Barea May 12, 2020

Hi Patrick, 

I received an email about this issue fixed in the last release of Scriptrunner.

I haven't tried yet.

Regards.

Patrick Gießler July 2, 2020

Yes, now it works

Tobias Banzhaf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 23, 2020
Like Maxime CORNET likes this

Suggest an answer

Log in or Sign up to answer