I am intending to use the "Database Picker" custom field offered by ScriptRunner in order to display the projects which the current user has permission to see.
I haven't found any solid answers about how I can modify the configuration script so far.
My "Retrieval/validation SQL":
select id, pname from project
where id = cast(? as numeric)
My "Search SQL":
select id, pname from project
where pname like concat(?, '%')
My "Configuration Script":
import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.canned.jira.fields.editable.database.SqlWithParameters
getSearchSql = { String inputValue, Issue issue, String originalValue ->
// return SqlWithParameters, that will control the search SQL..., eg:
new SqlWithParameters("select * from project where name like concat(?, '%')", [inputValue])