Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleArrayList<String> lookup(int lookupTableId, String srcColText, String srcValue, String destColText)

Execute the lookup and get the matching values provided by the user on input.

Aura inline button
paramsJTdCJTIybGFiZWwlMjIlM0ElMjJDb250YWN0JTIwQWtlbGVzJTIwU3VwcG9ydCUyMGZvciUyMG1vcmUlMjBBUElzJTIyJTJDJTIyc2l6ZSUyMiUzQSUyMm1lZGl1bSUyMiUyQyUyMnNoYXBlJTIyJTNBJTIyY2lyY3VsYXIlMjIlMkMlMjJzdGF0ZXMlMjIlM0ElN0IlMjJpZGxlJTIyJTNBJTdCJTIyY29sb3JzJTIyJTNBJTdCJTIyYmFja2dyb3VuZCUyMiUzQSUyMiUyM2ZmZmZmZiUyMiUyQyUyMmxhYmVsJTIyJTNBJTIyJTIzMjY4NGZmJTIyJTJDJTIyb3V0bGluZSUyMiUzQSUyMiUyMzI2ODRmZiUyMiU3RCUyQyUyMnNoYWRvdyUyMiUzQSUyMmUyMDAlMjIlN0QlMkMlMjJob3ZlciUyMiUzQSU3QiUyMmNvbG9ycyUyMiUzQSU3QiUyMmJhY2tncm91bmQlMjIlM0ElMjIlMjMyNjg0ZmYlMjIlMkMlMjJsYWJlbCUyMiUzQSUyMiUyM2ZmZmZmZiUyMiU3RCUyQyUyMnNoYWRvdyUyMiUzQSUyMmUyMDAlMjIlN0QlN0QlMkMlMjJsaW5rJTIyJTNBJTdCJTIydHlwZSUyMiUzQSUyMm1haWwlMjIlMkMlMjJ2YWx1ZSUyMiUzQSUyMnN1cHBvcnQlNDBha2VsZXMuY29tJTIyJTdEJTdE

Sample code

Code Block
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.akelesconsulting.jira.plugins.rest.LookupService
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.json.JsonSlurper

@WithPlugin("com.akelesconsulting.jira.plugins.LookupManager")

@PluginModule
LookupService lookupService

def log = Logger.getLogger("LookupManager")
log.setLevel(Level.DEBUG)

log.debug("***** Get table list *****")
def tableListText = lookupService.getTableList()
def tableListArray = new JsonSlurper().parseText( tableListText )
tableListArray.each { log.debug it }

log.debug("***** Get table id by name *****")
int tableId = lookupService.getTableIdByName("Project Category Table")
log.debug("Table id: " + tableId)

log.debug("***** Get table information ****")
def table = tableListArray.find {table -> table.name.equals("Project Category Table")}
log.debug("Table information: " + table)

log.debug("***** Get column information*****")
def columns = table.columns
log.debug("Column information: " + columns)

log.debug("***** Execute lookup to get matching values *****")
def matchingValuesArray = lookupService.lookup(tableId, "Category", "BUSINESS", "Project Key")
matchingValuesArray.each { log.debug it }

log.debug("***** Get table entries by table id *****")
def tableEntriesText = lookupService.getTableEntriesById(tableId)
def tableEntriesArray = new JsonSlurper().parseText( tableEntriesText )
tableEntriesArray.each { log.debug it }

...