Skip to end of metadata
Go to start of metadata

Problem

After upgrading users cannot create issues.

You will see the following error in the logs:

Caused by: java.lang.Exception: Missing parameters for fields

Workaround

Do not downgrade. Downgrading is not supported and will cause further issues in your Jira instance. 

Please make sure you have re-upgraded to at least 6.1.0 and run this script in the script console:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.canned.jira.fields.editable.ScriptField
import com.onresolve.scriptrunner.fields.ScriptFieldManager
import com.onresolve.scriptrunner.fields.ScriptFieldManagerImpl
import com.onresolve.scriptrunner.fields.ScriptFieldsStorage
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import static com.onresolve.scriptrunner.JiraPluginKeyProvider.JIRA_PLUGIN_KEY

def scriptFieldManager = ScriptRunnerImpl.scriptRunner.getBean(ScriptFieldManager)
def scriptFieldsStorage = ScriptRunnerImpl.scriptRunner.getBean(ScriptFieldsStorage)
def customFieldManager = ComponentAccessor.customFieldManager

customFieldManager.getCustomFieldObjects().findAll {
    if (it.customFieldType.descriptor.completeKey ==  JIRA_PLUGIN_KEY + ":jqlFunctionsCustomFieldType") {
        return false
    }
    it.customFieldType.descriptor.completeKey.startsWith(JIRA_PLUGIN_KEY)
}.each{ customField ->
    if (scriptFieldManager.getConfigFor(customField)) {
        return
    }
    def customFieldType = customField.customFieldType
    if (customFieldType instanceof ScriptField) {
        try {
            def config = customFieldType.getCommandObject()
            config.customFieldId = customField.idAsLong
            config.fieldConfigurationSchemeId = customField.configurationSchemes ?
                customField.configurationSchemes.first().id : -1L
            log.info("Adding script field config for '$customField.name'")
            scriptFieldsStorage.save(scriptFieldsStorage.load() + config)
        }
        catch (any) {
            log.error("Failed to create missing script field configuration for field: '${customField.name}', with id: ${customField.id}", any)
        }
    } else {
        log.warn "Unexpected custom field type: '${customField.name}', with id: ${customField.id}"
    }
}
//noinspection GroovyAccessibility
(scriptFieldManager as ScriptFieldManagerImpl).byFieldConfigSchemeIdCache.removeAll()
"Done"

This script should resolve the "Missing parameters for fields" error that is preventing you from creating issues.


  • No labels