Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4730

Mult-Select Database Picker - docs example with disabled options does not work

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: 6.9.1
    • Fix Version/s: 6.12.0
    • Component/s: Scripted Fields
    • Labels:
      None
    • Sprint:
      SR4J Sprint 87
    • Critical Points:
      0.7

      Description

      Steps to Reproduce

      Follow the steps to use disabled options with the database picker: https://scriptrunner.adaptavist.com/latest/jira/script-fields/database-picker.html#_dealing_with_disabling_options

      This was only tested for a picker in "single mode", and does not work for a multiple picker.

      Current Behaviour

      1. At the moment, the Multi-Select Database Picker option goes blank as shown in the image below:-
      2. Along with that error message Error occurred in provided SQL, contact your administrator. is displayed as shown in the image below:-
      3. An error message is also returned in the log as shown below:-
        2020-09-28 19:44:21,476+0800 http-nio-9091-exec-7 WARN admin 1184x828x1 12c0ony 0:0:0:0:0:0:0:1 /rest/scriptrunner-jira/latest/generic-picker/search [groovy.sql.Sql] Failed to execute: select fg, descr from sample_table2 join (values ('%'||?||'%')) t(txt) on (fg ilike t.txt or descr ilike t.txt) and (enabled = true or fg = ?) order by fg because: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
        2020-09-28 19:44:21,477+0800 http-nio-9091-exec-7 WARN admin 1184x828x1 12c0ony 0:0:0:0:0:0:0:1 /rest/scriptrunner-jira/latest/generic-picker/search [c.o.s.r.rest.jira.GenericPickerEndpoint] Error occurred in configuration for custom field, for field config scheme: 13501, input value: 
        org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
        	at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:955)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:189)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:189)
        	at com.atlassian.jira.ofbiz.sql.PreparedStatementWrapper.setObject(PreparedStatementWrapper.java:148)
        	at groovy.sql.Sql.setObject(Sql.java:4215)
        	at groovy.sql.Sql.setParameters(Sql.java:4171)
        	at groovy.sql.Sql.getPreparedStatement(Sql.java:4439)
        	at groovy.sql.Sql.getPreparedStatement(Sql.java:4527)
        	at groovy.sql.Sql.access$1100(Sql.java:236)
        	at groovy.sql.Sql$PreparedQueryCommand.runQuery(Sql.java:4723)
        	at groovy.sql.Sql$AbstractQueryCommand.execute(Sql.java:4654)
        	at groovy.sql.Sql.rows(Sql.java:2020)
        	at groovy.sql.Sql.rows(Sql.java:1838)
        	at groovy.sql.Sql$rows$0.call(Unknown Source)
        	at com.onresolve.scriptrunner.canned.jira.fields.editable.database.DatabasePicker$_getSearchResponse_closure1.doCall(DatabasePicker.groovy:111)
        	... 3 filtered
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
        	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37)
        	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:52)
        	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        	at com.onresolve.scriptrunner.db.AbstractDbConnectionManager.withSql(AbstractDbConnectionManager.groovy:67)
        	at com.onresolve.scriptrunner.db.AbstractDbConnectionManager$withSql$0.callCurrent(Unknown Source)
        	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        	at com.onresolve.scriptrunner.db.AbstractDbConnectionManager$withSql$0.callCurrent(Unknown Source)
        	at com.onresolve.scriptrunner.db.AbstractDbConnectionManager.withSql(AbstractDbConnectionManager.groovy:83)
        	at com.onresolve.scriptrunner.db.DbConnectionManager$withSql.call(Unknown Source)
        	at com.onresolve.scriptrunner.canned.jira.fields.editable.database.DatabasePicker.getSearchResponse(DatabasePicker.groovy:106)
        	at com.onresolve.scriptrunner.canned.jira.fields.editable.database.DatabasePicker$getSearchResponse$0.callCurrent(Unknown Source)
        	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        	at com.onresolve.scriptrunner.canned.jira.fields.editable.database.DatabasePicker$getSearchResponse$0.callCurrent(Unknown Source)
        	at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.AbstractGenericPicker.getSearchResponse(AbstractGenericPicker.groovy:103)
        	at com.onresolve.scriptrunner.runner.rest.jira.GenericPickerEndpoint.search(GenericPickerEndpoint.groovy:135)
        	at com.onresolve.scriptrunner.runner.rest.jira.GenericPickerEndpoint.search(GenericPickerEndpoint.groovy:129)
        	at com.onresolve.scriptrunner.runner.rest.jira.GenericPickerEndpoint.search(GenericPickerEndpoint.groovy:94)
        

      Expected Behaviour

      The options in Multi-Select Database Picker should be editable once the ticket is created.

        Attachments

        1. db_picker_1.png
          db_picker_1.png
          118 kB
        2. db_picker_2.png
          db_picker_2.png
          55 kB
        3. db_picker_3.png
          db_picker_3.png
          56 kB

          Issue Links

            Activity

              People

              Assignee:
              jechlin Jamie Echlin
              Reporter:
              rkumar Ram Kumar Aravindakshan
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: