Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Select options from project picker field when the options contain reserved words or parentheses

Mark Johnson June 21, 2023

Hello.

I'm using Behaviors in Jira to select certain options (Jira project names) that are preloaded in a Project Picker field.  By default, the Project Picker field lists all the projects in my Jira environment, but I'm trying to 'pick and choose' the projects I want loaded, based on certain criteria, when I create a task/issue.

The following code snippet limits some of the options that are loaded in the field when a new task/issue is created:

def proj_options = projects.findAll{

    if(it.name}{

        it.name in ["AB(C) Test", "Proj1", "Proj2", "Test Config"]

)]

formfield.setFieldOptions(proj_options)

The code works for projects Proj1 and Proj2; however, projects AB(C) Test and Test Config are not loaded in the field.  I believe this because one project name has "(" and ")" in it and the other has a reserved word ("Config") in it.

I've tried using the character escape option, but that didn't work (I may not have use it correctly).

Will someone please let me know how to fix this line - it.name in ["AB(C) Test", "Proj1", "Proj2", "Test Config"] - so those two other projects will appear in the field list?

 

Thanks,

Mark

 

0 answers

Suggest an answer

Log in or Sign up to answer