I have a requirement to email a list of all new Jira users on a weekly basis to our Training team so they can add Jira training to those users' training plans. To accomplish this task, I've created a Scriptrunner resource pointing to my local database and have created a Scriptrunner scheduled job using the partial script below. For some reason, the script only works if I don't include a 'where' clause in the select statement; obviously not acceptable. As soon as I do, I get an error indicating 'unexpected token : Imp @ line 4 column 87. I've tried this from the script console as well and got the same results.
import com.onresolve.scriptrunner.db.DatabaseUtil
def rows = DatabaseUtil.withSql('local') { sql ->
sql.rows('select id,customfieldtypekey,cfname from customfield where cfname like 'Imp%')}
def sqlTable = new StringBuffer()
sqlTable<<"""<table class="aui"><tr>"""
rows.first().keySet().each{
sqlTable<<"""<th>$it</th>"""
}
sqlTable<<"</tr>"
rows.each{ columns ->
sqlTable<<"<tr>"
columns.each{ cell ->
sqlTable<<"<td>$cell.value</td>"
}
sqlTable<<"</tr>"
}
return sqlTable
I'm running Jira Data Center v8.5.3 and Scriptrunner v6.7.0 with postgreSQL v9.6 on Windows 2016 server (VM).
Thanks in advance for your time and assistance