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

Can i obtain the screen name of a specific transition in my REST Endpoint script?

Hi, I have a REST endpoint script that returns all transitions in my JIRA instance, along with work some other info such as associated workflow, to and from status etc and produces all the info in CSV format. This works perfectly as it is...

What i would like to do is also return the screen name associated with each transition. Is this possible? Please see my current code below.

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript

import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response

@BaseScript CustomEndpointDelegate delegate

getAllWorkflowTransitions(httpMethod: "GET", groups: ["jira-administrators"]) { MultivaluedMap queryParams, String body ->
def result = []
ComponentAccessor.workflowManager.activeWorkflows.each { wf ->
wf.allActions.each { action ->
wf.getStepsForTransition(action).each {
def destStep = wf.descriptor.getStep(action.unconditionalResult.step)
result.add([
workflow: wf.name,
transitionName: action.name,
transitionId: action.id,
source: it.name,
sourceId: it.id,
sourceGlobalId: it.metaAttributes["jira.status.id"],
destination: destStep.name,
destinationId: destStep.id,
destinationGlobalId: destStep.metaAttributes["jira.status.id"]
])
}
}
}
def output = ""
result.each {
// set CSV header if this is the first record
if (output == "") {
output += it.collect { key, value -> "\"${key}\""}.join(",") + "\n"
}
// output CSV row
output += it.collect { key, value -> "\"${value}\"" }.join(",") + "\n"
}
return Response.ok(output).build();
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events