You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am using "convertToSingleSelect" to convert custom text field to drop-down . I want to make it conditional i.e
a) Select dropdown when response is not NULL
b) Free text when response is NULL .
To do that, you would have to have to make your rest call twice, once to pre-validate if there is any response, and if so, then make the conversion with the ajaxOptions.
Alternatively, don't use the ajaxOptions, make your rest request, verify the response is not null then convert to single select with setFieldOptions
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
def httpBuilder = new HTTPBuilder(urlOfYourDataSource)
def responseData
httpBuilder.request(Method.GET, ContentType.JSON) {
response.success = {resp, data ->
responseData = data
}
response.failure = {resp, text ->
log.error "Error: $text"
}
}
if(responseData){
//you may need to transform you data to get a map of id and values for the select
def map = someFunctionToTransformYourResponse(responseData)
def textFld = getFieldByName("textFieldToConvert")
textFld.ConvertToSingleSelect().setFielOptions(map)
}
Note that with this approach, you can't repeat the request with each keyPress.
But the typeAhead search/filtering will still work on the full data set.
Thanks for your quick response .
I have thought about this approach but it was taking two API calls that's where I stuck .
I want to make this in single API call other wise we can prepare drop-down using jQuery.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.