JIRA call to external web service to return list of values to populate field Edited

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 :-) 

1 answer

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

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

Hi Stephen,

I think these are just static type checking errors. Does it work if you save it and run it?

Thanks,
Adam

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 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

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,979 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot