Skip to content

Instantly share code, notes, and snippets.

@vikrantyadav11
Created May 12, 2021 09:37
Show Gist options
  • Select an option

  • Save vikrantyadav11/6148856ed065687e89f5c65adc9e860d to your computer and use it in GitHub Desktop.

Select an option

Save vikrantyadav11/6148856ed065687e89f5c65adc9e860d to your computer and use it in GitHub Desktop.
Run SQL query in script console
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.db.DatabaseUtil
import groovy.sql.Sql
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface
def issueManager = ComponentAccessor.issueManager
def output = []
def result = [:]
DatabaseUtil.withSql('local_db') { sql ->
output = sql.rows("""select cfname from customfield where customfieldtypekey = 'com.atlassian.jira.plugin.system.customfieldtypes:select'""")
}
log.warn "${output.size()}"
log.warn "${output.asList()}"
output.each {
result = it as Map<String,String>
}
result.each {
log.warn it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment