If you replace the configuration context that's associated with a Database Picker script field, the ID for the new configuration context won't be updated for the script field and it will throw an error when trying to retrieve results:
- In a clean Jira instance, create a new project and a single issue within that project
- Navigate to the Resources tab in the ScriptRunner admin section and create a new local database resource
- Head over to the Fields tab and create a new Database Picker field, using the local DB resource you just made
- Now, go to the Jira Custom Fields page, and add the field to the Screens associated with the project you created in the first step
- From there, make your way to the Configuration Scheme page for your new DB picker
- You can do this by clicking on the cog wheel to the right of the DB picker field on the Custom Fields page, and then clicking "Configure"
- Once on the configuration scheme page, delete the existing global context, and create a new one in its place
- Now, navigate to the "Search for issues" page, and attempt to use the Database Picker dropdown.
- Upon doing this, you should notice the aforementioned error appears under the select list for the field.
This appears to happen because the ID for the configuration context doesn't get updated to match the ID of the newly created context, so the old ID is sent to the endpoint that handles the DB picker search functionality. This causes a permissions error to be thrown on the backend, breaking the field altogether and making it essentially unusable across the instance.
After updating the IDs used in the script to match your use-case, you can run this script in the Script Console to bring the Script Field config context ID and Custom Field config context ID back in sync with one another.