Import custom field values from API REST

Hi all!

I have a question related with Script Runner and how import values to a custom field from the result of a API REST endpoint.

For example, you have a custom field. The format of this custom field is a select where you can select one value, of a list of vaules. This values are imported from an API REST request. Then, you can select one of this values.

So, you have the field "My custom field" with the values: "Value 1", "Value 2" and "Value 3" that have been retrived by the endpoint:

http://myapi.com/myendpoint

Whose response is a JSON with the values {"Value 1", "Value 2", "Value 3"}

Then, you can select in this custom field the value, for example: "Value 1". And when the issue is saved, the value of "My custom field" is set to "Value 1".

Is this possible with Script Runner? 

BTW, this could be done in an JIRA Cloud.

1 answer

This widget could not be displayed.

Hi Miguel,

There is an almos exact example in the documentation. 

Select List Conversions

In your case you do not have to do the Database related actions, just to populate the map that you will return. 

Please let me know if you need any further assistance. 

regards, Thanos

Hi Thanos,

Thank you so much for your quickly response! 

I've read the example and it's very useful, but I have a question, in the example it's said that:

"Finally connect it to a text field in your behaviour initialiser"

But, as far as I know, "behaviour" functionallity it's only available on Scipr Runner for JIRA Server, isn't it? The example I mentioned needs to work on JIRA Cloud, if is possible. Otherwise, I need to consider changing to JIRA Server.

Thank you!

Regards,

Miguel.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

135 views 16 7
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