Access development information in jira

sbhutada January 17, 2019

How can I access development information of Jira. I also have scriptrunner plugin. Is there any way to extract that information of that section?

Before moving the ticket to next state, I want to check if the code is checked in to bitbucket from that development section of jira.

Screen Shot 2019-01-17 at 2.44.43 PM.png

2 answers

1 accepted

0 votes
Answer accepted
sbhutada January 18, 2019

I checked other posts and with few tweaks I was able to extract the information -

import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.plugin.devstatus.api.DevStatusSummaryService
import com.atlassian.jira.plugin.devstatus.rest.DetailBean
import com.atlassian.jira.user.ApplicationUser
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

def log = Logger.getLogger("Dev Summary")
log.setLevel(Level.INFO)
log.info('....')

 def ccm = ComponentAccessor.getComponentClassManager()
def service = ccm.newInstance("com.atlassian.jira.plugin.devstatus.impl.DefaultDevStatusSummaryService")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issue = ComponentAccessor.getIssueManager().getIssueObject("Test-1")
def details = service.getDetailData(issue.id, "stash", "pullrequest", currentUser).right().get().getDetail()
log.info(details)
Santosh Subramani October 30, 2020

Hello @sbhutada , 

i have similar request , where i would like to know if any pull request is still open before making the transition. 

Could you let me know where i have to write the above code in post function

0 votes
Mehmet Sari December 2, 2021

devstatussummaryservice not accessible that way anymore. 

but still works with this:

https://community.atlassian.com/t5/Answers-Developer-Questions/Access-development-information-from-groovy-script-runner-in/qaq-p/517778

 

def ccm = ComponentAccessor.getComponentClassManager()
def service = ccm.newInstance("com.atlassian.jira.plugin.devstatus.impl.DefaultDevStatusSummaryService")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-2")
def details = service.getDetailData(issue.id, "stash", "pullrequest", currentUser).right().get().getDetail()

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events