JIRA Issue Field option with project defined in scope shows in all projects

Suppose there is a custom JIRA Issue Field defined in the connect app.

"jiraIssueFields": [
      {
        "description": {
          "value": "My Field"
        },
        "type": "single_select",
        "name": {
          "value": "My Field"
        },
        "key": "my-issue-field"
      }
    ]

I have added several options to this field like this:

{
  "id": 1,
  "value": "My option 1",
  "config": {
    "scope": {
      "projects": [10001]
    }
}

According to the documentation, especially according to the IssueFieldOptionConfiguration link inside this page:

this “Defines the projects that the option is available in”.

But this doesn’t work, the option is available in all projects anyway.

Am I doing something wrong?
Thank you for any hint.
Ales

And another question: there are two similar properties in the scope: projects and projects2. What is the difference between them? Documentation is silent about this unfortunately :frowning:

"scope": {
      "projects": [],
      "projects2": []
}

Thanks for any hint.
Ales

Hi @KahanekAles,

The documentation actually says that that the projects property is deprecated (you’ll see it if you drill down into the IssueFieldOptionScopeBean definition). Therefore it should not be used. The correct way to mark your option as available only in project 10001 would be:

{
  "id": 1,
  "value": "My option 1",
  "config": {
    "scope": {
      "projects2": [
         { "id": 10001 }
      ]
    }
}

Hope this helps :slight_smile:

Hi @kkercz,
thank you for your reply. It’s been a while and I now I am back to the project (was busy on another one).

You are right, the documentation says that the “projects” is deprecated, my bad.

I have tried the projects2 property but this doesn’t work for me either.

Now I have 2 options:

{
   "id":1,
   "value":"Test 1",
   "properties":{},
   "config":{
      "scope":{
         "projects":[10000],
         "projects2":[{ "id":10000, "attributes":[] }],
         "global":{}
      },
      "attributes":[]
   }
}

and

{
   "id":2,
   "value":"Test 2",
   "properties":{},
   "config":{
      "scope":{
         "projects":[],
         "projects2":[],
         "global":{}
      },
      "attributes":[]
   }
}

There are 2 projects: 1000 and 10001.

I suppose, that the option “Test 1” should appear only in issue belonging to project 1000 and option “Test 2” should appear in all projects. Is it right?
But the both the options are visible in all projects.

What is wrong with the options?

BTW: You can see, that the project 1000 appears in the config.scope.projects array in the option “Test 1”. I didn’t assign any value to “projects”, only to “projects2” and it seems that Jira did this itself.

I have tried to delete the project from the “Test 1” config scope. I have assigned an empty array to the projects2,

myItem.config.scope.projects2 = []

send successfully the PUT request to JIRA but the project 1000 still have remained in the projects2 property. The project should be deleted from both the projects and projects2 arrays (not documented IMHO) and only then it is deleted successfully.

Thank you for any hint.
Aleš

Not quite. If you dig into the documentation of IssueFieldOptionScopeBean you’ll see that property global is described thus:

Defines the behavior of the option within the global context. If this property is set, even if set to an empty object, then the option is available in all projects.

So to create an option that is not available globally, you need to set global to null.

@kkercz Great! It now works! Thank you very much.

The last thing that doesn’t work for me is deleting an option from the issue:

image

I have assigned the option to the issue successfully. Then I tried to remove it from the issue by clicking to the “x” icon, the edit became empty, then edited successfully other fields in the issue. But after issue refresh, the option is still there. Changes in other standard fields were preserved.

That’s weird. I’m afraid it might be a bug. As such, I would suggest creating an issue for it in the ACJIRA project.

Thank you for your reply. I appreciate it. I have created the ACJIRA-2277 issue.
Ales

1 Like