I have write a script which executes saved procedure and gets values. The script works in console but when I placed the script into behaviours the script the script stopped working. I have a message in the logs.Could you please what the reason of this problem.
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FormField
import com.onresolve.scriptrunner.db.DatabaseUtil
import groovy.sql.Sql
import org.apache.log4j.Level
import org.apache.log4j.Logger
log = Logger.getLogger("com.acme.CreateIssue")
log.setLevel(Level.DEBUG)
FormField lotTovara = getFieldByName("Лот товара")
FormField summary = getFieldById('summary')
def rows = []
def value = DatabaseUtil.withSql('Test') {
it.callWithRows "{call ksas_exp.pr\$get_lot_photo(?,?,?)}", [lotTovara, Sql.VARCHAR, Sql.VARCHAR], {name, path ->
rows.add(name)
rows.add(path)
}
}
log.debug(rows)
def valueSummary = summary.getValue()
def valueLot = rows
summary.setFormValue(valueLot)
erorr
2020-03-05 12:22:10,477 http-nio-8080-exec-7 WARN user 742x57961x1 1ymuehn 10.7.16.80,10.9.1.65 /rest/scriptrunner/behaviours/latest/runvalidator.json [groovy.sql.Sql] Failed to execute: {call ksas_exp.pr$get_lot_photo(?,?,?)} because: Invalid column type 2020-03-05 12:22:10,478 http-nio-8080-exec-7 ERROR user 742x57961x1 1ymuehn 10.7.16.80,10.9.1.65 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl] ************************************************************************************* 2020-03-05 12:22:10,480 http-nio-8080-exec-7 ERROR user 742x57961x1 1ymuehn 10.7.16.80,10.9.1.65 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl] Script function failed on issue: (create issue) project/issuetype: TEST/Test, user: user , fieldId: customfield_13001, file: <inline script> java.sql.SQLException: Invalid column type at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8079) at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7581) at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8332) at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4573)
What type of data is SQL expecting lotTovara to be?
Can you share what your equivalent console script looks like for setting that variable?
In console, you won't typically have access to getFieldByName(), so I suspect you are setting lotTovara to something else. Then, in that case, you must find a way to convert to the expected data type.
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.