I'm trying to use a scripted field (Adaptavist Scriptrunner) Issue Picker.
I would like this field to use a JQL that is based on a value from within the ticket that the field is on.
Couldn't really find anything regarding this (whether I can use a dynamic JQL or if this needs to be scripted) in the documentation.
Hi @Dirk Ronsmans ,
I found a solution from scriptrunner documentation
https://scriptrunner.adaptavist.com/6.5.0-p5/jira/behaviours-conversions.html
and the hint at issue picker field configuration
JQL that the issue picker will select from. Leave blank to allow any issue
You can modify this with Behaviours using field.setConfigParam('currentJql', '<your jql query>')
My problem was, that Behaviour does not work on view screen but I can edit the field on view screen.
After I added a server sided script in a Behaviour I saw that the edit screen opens when I tried to edit the field with the server sided script in view screen.
So I added the same script for the issue picker field.
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviour
final FormField myFirstField = getFieldByName("My first field")
final FormField mySecondField = getFieldByName("My second field")
final def firstFieldValue = myFirstField.getValue()
if (firstFieldValue) {
mySecondField.setReadOnly(false).setDescription("Select an issue with '${firstFieldValue}'")
mySecondField.setConfigParam('currentJql', '"My first field" = ${firstFieldValue}')
} else {
// selected first field was null - disable control
mySecondField.convertToShortText()
mySecondField.setReadOnly(true).setDescription("Please select my first field before entering the issue")
}
Also you can write on Adaptavist`s support - they have an excellent team!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Dirk Ronsmans
I had the same question before - https://community.atlassian.com/t5/Jira-Core-questions/Scripted-field-where-we-can-see-the-JQL-filter-s-results/qaq-p/1018559
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the feedback.
Doesn't look like it's entirely the same question but similar enough to piece together a solution!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dirk Ronsmans ,
did you find a solution for this?
We have exactly the same requirement like you.
Regards
Erik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.