Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Call Rest API and filter result in field

Hello, i have Jira server v8.2.3 and Scriptrunner 6.20.0

I try to do this
1/ Get information from api rest
2/ Parse result and store result (database ? custom field option ?)
exemple
        projet pkey A10 value HUM0010
        projet pkey A10 value HUM0011
        projet pkey A20 value HUM0012
        projet pkey A20 value HUM0013
        projet pkey A30 value HUM0014
        projet pkey A40 value HUM0015
(only get 1 time per day)

3/ Have a custom field where selection is filter by issue context (projet key)
This field could be edit by users, user select value

key project is for example A10 and user possible select in field was HUM0010 or HUM0011
(filter by projet pkey)

I try to use "Script Fields" but field can't be edit by user

A "Behaviours" script can do this ?
Did you have idea for storage data ?
And idea for field filter for user ?


Thanks

Fred

1 answer

1 vote

There are a few different directions you could use for this

  1. Behaviour Select Conversion - live
    • User field will be "Test"
    • Behaviour script will change it to select dropdown based on the current project context
    • Remote API is called with each user input
  2. Behaviour Select Conversion - stored data
    • Same as above but api called will be a custom rest api built with script runner that looks at data stored locally
    • The data stored locally is refreshed 1x per day by a job that makes the remote rest api
    • Suggested data storage: application properties (see script example below)
  3. Select Field options with automatic option refresh
    • User field is Single Select
    • 1 configuration context for each project
    • Remote API is called 1x per day by a job and options in each context are added/disabled 

Example local storage

import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
import com.atlassian.jira.component.ComponentAccessor
def data = [
[pkey:'A10', values:['HUM0010', 'HUM0011']],
[pkey:'A20', values:['HUM0012', 'HUM0013']],
[pkey:'A30', values:['HUM0014', 'HUM0015']],
]
//store the data
ComponentAccessor.applicationProperties.setText('mycustomkey', new JsonBuilder(data).toString())
//retreive the stored data
def myData = new JsonSlurper().parseText(ComponentAccessor.applicationProperties.getText('mycustomkey'))

Hello, thanks for your reply.

I remember solution 2, i have store data with sucess.

With this solution, i have to create 2 fields ? 1 for project key (issue contexte) dans 1 for select value ?

With Behaviours Select List Conversions, in "Initialiser", i don't understand what to put on.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

☕️ Monday coffee with Jexo: Weekly Atlassian news roundup | 21st June 2021

Hi community 👋, as every Monday we're bringing you a quick update on what happened in the Atlassian ecosystem last week. There were a few interesting events like for example the announcement of th...

56 views 0 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you