In jira, I want to select a value from a select list.
The select list is a list of emails in all sort of lower\upper\camel cases.
The input is in a random case.
I need to find the input inside the value list and then choose it and assign it to the issue.
Ah I see your point. So the getOption() wont fetch the correct option as it might not even be in lowerCase. interesting challenge.
Let me have a play around with this today to see if we can craft something?
Are you doing this on a Jira Cloud instance, in a software project?
Iâm using both jira cloud and jira DC (on-prem).
This is my current solution, itâs using the general Jira API and itâs long. I hope there is something more simple:
So that the cases wont be an issue anymore, but letâs try to do this programmatically if at all possible. The code you shared should already be working on the DC side. Are you specifically looking for a similar solution on Cloud?
Well, I wouldnât consider it irrelevant as you can map the incoming value to the exact value present on the destination drop down, and then use this mapped value to get the correct option. It should work for sure, but yes, requires manual maintainance in case source or destination drop down values are changed or added/deleted.
Let me try to get this working on the cloud side via a script to do this dynamically though.
I quickly set up a custom text field called Source Field and a drop down select list on my Jira Cloud called Color. The Color drop down has the following options:
I ran a GET call to this endpoint with the fieldId and contextId hardcoded in the call itself. Then iterated over the returned results and found which option actually matches the replica value, and once found, assign it.
Hi @Majid
Thank you for the suggestion.
I think this API call is open for jira admins only, are you sure it will work when the exalate sync user doesnât have admin privileges?
Hi @francis
Using getOptions was my first try as you can see in my initial message in the thread. But getOptions is for setting new content to the field and not for getting all the options for a field.
E.g. getOptions(issue,âemailsâ) wonât work.