Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ScriptRunner Database picker: custom script and SQL fields?

Adrienne Bolger August 20, 2020

This is a question specifically about the Adapativist ScriptRunner "Custom Field" of type "Database Picker".  (This question is here because the Adaptavist documentation specifically says questions about the plugin should be posted in this community)

I am attempting to follow documentation as laid out here:

https://scriptrunner.adaptavist.com/6.6.0/jira/script-fields/database-picker.html#customisations

For design reasons, my team and I want to use the 'Configuration Script' field of the Database picker to override the search and validate options on this fields.

We have implemented our 'getSearchSql' and related functions in the Configuration Script as recommended in the documentation. HOWEVER, when I try to preview our custom functions, I get the following:

Screen Shot 2020-08-20 at 12.16.43 PM.png

Now, we have DELIBERATELY left these blank because we override them in the Configuration Script field.  The form doesn't care. 

 

So my question is:

1. Is this a bug or a feature?

2. What goes in the boxes such that they will be ignored in favor of our custom script?

This MUST be possible- there are example snippets that perform this override. But I can't make it work with my code setup.

 

2 answers

0 votes
Yen-Wu Lo August 28, 2020

I'm studying this new feature as well and here's my understanding:

If you want to query WITH user input, then you use retrieval/validation and search SQL to do query, and the configuration script to do some filtering.

If you want to query WITHOUT user input, then just use retrieval/validation and search SQL to do query, while leaving configuration script blank.

Yen-Wu Lo August 30, 2020

Just in case anyone needs this: if you're running Jira Service Desk Server and you want to use this new Configuration Script feature, you might need to upgrade your JSD as well. Mine did not function correctly until I did the upgrade.

0 votes
Adrienne Bolger August 20, 2020

Update: here's an example of my problem: I want to run a query using the database picker that SHOULD NOT use the user input to show options (this may seem silly here but the actual use case is more customized than that). It appears with the current plugin that I can't do this without some dummy SQL that is definitely getting run even though the override is ALSO getting run and is what controls the results. Basicially, SQL is getting run twice and should not be. 

The screenshot below shows what happens.

 

Screen Shot 2020-08-20 at 12.47.21 PM.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events