Hi...I have two fields, Project Names and Leadership which show values via rest end points. The challenge is that Leadership values depend on the values selected in Project Names. Both list are multiselect.
Following the instructions in the last example in the scriptrunner documentation for Select List Conversions (Dynamically Changing the Picker Query), I was able to have it almost working but for some reason when I select a value from the Project Names list, a text box appears below the Leadership field. Leadership field selection list shows the proper values though (the values related to the project selected in Project Names), but a text box is added in the screen right below Leadership. If I added another project name in the Project Names field, then another text box is added again to the Leadership field and so on.
Any assistance is greatly appreciated.
This is the server side behavior for the Project Names field:
import org.apache.log4j.Logger
import org.apache.log4j.Level
def selectedProjects = getFieldById(getFieldChanged()).value as Object
//def jqlSearchField = getFieldByName("ED Emails TEST")
def jqlSearchField = getFieldByName("Leadership")
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)
log.debug(selectedProjects)
if (selectedProjects)
{ jqlSearchField.setReadOnly(false).setDescription("Select your EDs involved with these projects. Don't see all of them? Please note who is missing in the comments.") jqlSearchField.convertToMultiSelect([ ajaxOptions: [ url : getBaseUrl() + "/rest/scriptrunner/latest/custom/getEDs", //query: true, data : [ projects: selectedProjects ], // minQueryLength: 0, //keyInputPeriod: 500, formatResponse: "general", ], css : "max-width: 500px; width: 500px", ]) }
else
{ // selected project was null - disable control jqlSearchField.convertToShortText() jqlSearchField.setReadOnly(true).setDescription("Please select your projects before choosing EDs") }
And I have this in the initializer, also in the Project Names field:
getFieldByName("Project Names").convertToMultiSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/getProjectNames",
query: true, // keep going back to the sever for each keystroke
minQueryLength: 0,
keyInputPeriod: 500,
formatResponse: "general",
]
])
For the Leadership field, I dont have any behavior since configuring or not a behavior for the Leadership field does not make a difference.
Thank you for your assistance
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.