Is it possible to configure a JIRA custom field to show a list of selectable options which are populated by a call to external web service using Scriptrunner? I am basically looking to make a call to a SOA rest api which will return a list for the user to select from. This will then in turn populate my custom field... I am new to Groovy so any examples would be appreciated. Thanks :-)
Hey Stephen!
If I'm understanding you correctly, then I believe you could accomplish this with a Behaviour and a select list conversion. We have some examples and further documentation on the process here.
Let me know if that looks like it'll work for you or if you have any questions! :D
Best,
Aidan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aidan, thank you for your response...I have tried this script and manipulated it to my URL etc but i am seeing a couple of errors... the first errors tell me that the uri.path, headers and response.failures variables are undeclared... Am i missing part of the script? any guidance appreciated, thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephen,
I think these are just static type checking errors. Does it work if you save it and run it?
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam, thanks for coming back...
i have been looking at a simpler alternative... is it possible with a behaviour to restrict the values that are allowed in a custom field?
I have a single line text field but i would like to create a behaviour that will restrict what values could be saved in the field and return an error if an incorrect value was input and a save attempted? I was wondering whether i could create a behaviour to do this?>
i am aware that i could create a new field of the select list type but i was hoping i might be able to lock my single line text field down with a behaviour?
thanks :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could use a behaviour to do this. Unfortunately populating the list dynamically is not a good fit for behaviours.
If your getting the values from a REST API your really best off using the select list conversions part of behaviours.
If your no longer doing this and have a text field. You can of course check the content using a behaviour and then setting an error if it's not allowed.
There are many examples online and recipes here to get you started.
Hope this helps.
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Adam - I have already been trying to find a similar example on the Scriptrunner site and wider internet but havent come across a specific one that validates the value being input into a field but ill keep digging.
Thanks.
Stephen
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.