Mismatched filed context id between Get custom field contexts and Get custom field configurations

Our app is Forge app for Jira Cloud.
One of our customer’s Jira site returns mismatched contextId between GET /rest/api/2/field/{fieldId}/context and GET /rest/api/2/app/field/{fieldIdOrKey}/context/configuration.

The rest API request-response details
Request to Get custom field contexts
GET /rest/api/2/field/customfield_12658/context?maxResults=100&startAt=0

Response

        {
            "maxResults": 100,
            "startAt": 0,
            "total": 1,
            "isLast": true,
            "values": [
              {
                "id": "13509",
                "name": "Default Configuration Scheme for Sample Field",
                "description": "Default configuration scheme generated by Jira",
                "isGlobalContext": true,
                "isAnyIssueType": true
              }
            ]
          }

Request to Get custom field configurations
GET /rest/api/2/app/field/customfield_12658/context/configuration

Response

        {
            "maxResults": 100,
            "startAt": 0,
            "total": 1,
            "isLast": true,
            "values": [
              {
                "contextId": 13510
              }
            ]
          }

I think the context ids (13509 and 13510) have to be the same. But, they are not.
I can’t reproduce it on my site. So, I can’t find out the condition to reproduce.
Is it an unexpected behavior? How can it be recovered?

Additional information

  • New custom fields fall into the same state.
  • Nothing changed to field contexts after the field is created.

Please help.

1 Like

This is not expected. After a thorough analysis, we will release a change next week (on Monday if all goes well) that makes things right.

The field and query param contextId in the Issue custom field configuration (apps) operation will be deprecated and replaced with:

  • id , the ID of the configuration entry, which behaves in the same way as the deprecated contextId . Note, this is not the ID of the field context the configuration is associated with, contrary to the previous name.
  • fieldContextId , a reference to the field context ID the configuration is associated with.

The reason for this change is that while contextId was intended to be a reference to a field context ID, in some cases it wasn’t. fieldContextId will serve this purpose now.

The contextId field and query param will be removed on 1 March 2022.

2 Likes

Thank you for your reply.
I understood the coming changes. I will adopt the changes as soon as it’s released.

Hi Krzysztof,
we are still facing this problem (mismatch contextId ) when calling /rest/api/2/field/{fieldId}/context.
Are you sure this problem has been solved? :slight_smile:

Regards,

Hey @RichardHamilton,

That’s concerning. Would you mind describing the problem in more detail?

This problem occurred in one of our customer.
In the custom field configuration (Forge custom field type module) we have contextId=10388 retrieved from the context object “view.getContext()”,
Elsewhere when calling for the same custom field: rest/api/3/field/customfield_10215/context we received:
{ "maxResults":50, "startAt":0, "total":1, "isLast":true, "values":[{ "id": "10387", "name": "Default Configuration Scheme for Catagory (ITS)", "description": "Default configuration scheme generated by Jira", "isGlobalContext":true, "isAnyIssueType":true}]}
As you can see, id=10388 does not match 10387.
Additionally, I have a response from rest/api/3/app/field/customfield_10215/context/configuration: {"maxResults":100,"startAt":0,"total":1,"isLast":true,"values":[{"id":"10388","fieldContextId":"10387"}]}
Which id corresponds to the contextId retrieved from view.getContext() in the Forge module?

The context ID retrieved from view.getContext() would match the id property from the response from rest/api/3/app/field/customfield_10215/context/configuration, not fieldContextId. So it seems everything is in order.

ok, good to know.
To clear this up: What is/means the “id” from the rest/api/3/field/customfield_10215/context?

id from rest/api/3/field/customfield_10215/context is fieldContextId from rest/api/3/app/field/customfield_10215/context/configuration.