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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,216
Community Members
 
Community Events
184
Community Groups

How do I use Database Picker with custom pickers

I am trying to use the Database Picker custom field to present a drop down single-selection list for my users to choose 1 approver to remove at a time and associate a justification of removal for each. I have the following query set in the Search SQL field:

select cfv.id, upper(app_user.lower_user_name), issue
from customfieldvalue cfv
JOIN app_user on app_user.user_key = cfv.stringvalue
where customfield IN ( select id from customfield where cfname = 'Approvers' ) and app_user.lower_user_name like ? || '%'
;

The problem is that it's returning the full list of Approvers from all my tickets, whereas I am trying to only return the approvers for the issue that the field is on. 

I've tried the customizations, but it did not appear to have any effect:

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 cfv.id, upper(app_user.lower_user_name), issue " +
"from customfieldvalue cfv " +
"JOIN app_user on app_user.user_key = cfv.stringvalue " +
"where issue = ? and customfield IN ( select id from customfield where cfname = 'Approvers' ) and app_user.lower_user_name like ? || '%';", [issue.getId() , inputValue])
}

Either method does not change the results and outputs the complete list of approvers from all issues.

Any help would be greatly appreciated. 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events