Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,458
Community Members
 
Community Events
176
Community Groups

Why work attribute doesn't get values from the script rest endpoint?

Edited

Hello.

We have jira version 7.12.3.

And now these is installed Tempo plugin v 8.13.1 and Adaptavist ScriptRunner for JIRA 5.7.1.
Following the tutorials on the link https://scriptrunner.adaptavist.com/4.3.4/jira/plugins/working-with-tempo.html I added work attribute for worklogs with dynamic drop-down type. This work attribute values gets from rest endpoint api. It's worked.

REST endpoint script:

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import com.atlassian.jira.plugin.webfragment.model.JiraHelper
import com.atlassian.jira.issue.Issue

@BaseScript CustomEndpointDelegate delegate

tempoWorkSystem(httpMethod: "GET", groups: ["jira-users"]) { MultivaluedMap queryParams, String body ->
JiraHelper jiraHelper = new JiraHelper()
def callbackFn = queryParams.getFirst("callback")
def options = [
values: [
[
key: "",
value: "Please select"
],
[
key: "001",
value: "A"
],
[
key: "002",
value: "B"
],
[
key: "003",
value: "C"
],
[
key: "004",
value: "D"
],
[
key: "005",
value: "F"
],
[
key: "006",
value: "E"
]
]
]

def resp = """${callbackFn} ( ${new JsonBuilder(options).toPrettyString()} )""".toString()
return Response.ok(resp).build()
}

 

API for call in the work attribute settings: local-jira-base-url/rest/scriptrunner/latest/custom/tempoWorkSystem

But I did this when another tempo plugin versions is installed. After update tempo plugin from version 8.4.1,  work attributes values list is empty. Idk, why?

There is a "no results found" instead list of values.

Please, tell me how to fix it? Why did it stop working?

Thank you.

 

2 comments

Hi,

this is under investigation by Adaptavist. You can follow up on the ticket.

Thanks and regards

Like Aoka Aoki likes this

The key issue is to force the script to set the content type to use "application/javascript". If anyone could help out on how to do this would be much appreciated.

Thanks

Comment

Log in or Sign up to comment