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

Access development information from groovy script-runner in workflow transition

Mikhail Leonov Sep 01, 2016


We are using JIRA Software, Bitbucket Server, Bamboo Server. I'd like to trigger a specific bamboo build after a JIRA workflow transition. To do these I want to gather additional information from the issue, like last successful build, assignee and.. Bitbucket branch.

I already tried access these data via script-runner as mentioned here but realized that this solution only applicable if we are using Bitbucket cloud or Github. It will not work if we work with Bitbucket Server

In general, I have a two ideas of how I can access development data(such as branch, pull-request, e.t.c):

  1. via Bitbucket application link
  2. via Java API of "jira-software-plugin"

The question is, where I can find an API of "jira-software-plugin" or can someone helps me with accessing data via application link?

Thank you,


7 answers

1 accepted

2 votes
Answer accepted
Mikhail Leonov Sep 20, 2016

I, finally, found a solution of my problem!

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.plugin.devstatus.api.DevStatusSummaryService
import com.atlassian.jira.user.ApplicationUser
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

DevStatusSummaryService devStatusSummaryService = ComponentAccessor.getOSGiComponentInstanceOfType(DevStatusSummaryService.class)

ApplicationUser currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

DetailBean pullRequestData = devStatusSummaryService.getDetailData(, "stash", "pullrequest", currentUser).get()


pullRequestData object will contain information about pull-requests and branches of the issue. You could use the same approach for accessing bamboo builds data as well.

Thank you all,

Adam Markham [Adaptavist] Community Leader Sep 20, 2016

Hi Mikhail,

Glad you got it working. I came across that plugin while investigating this and it seems that you can't access the source code for it. It looks like its one of those you need to unzip the JAR for and decompile to see whats going on.

Nice use of @WithPlugin.


Manjunatha K R Dec 12, 2016

Thanks Mikhail for sharing this nice script.

I am using SVN sub-version and would like to get the branches of the issue(i,e to which are all branches JIRA issue Fix is submitted) using pullRequestData object. 

DetailBean pullRequestData = devStatusSummaryService.getDetailData(, "subversion", "pullrequest", user).get()

can you please suggest how to get the 'branches of the issue'(s) details and compare with one custom field to match with. Thanks. 

Manjunatha K R Dec 13, 2016

I added the script as part of project workflow scripted post-function and got the below output after adding the below line::

DetailBean pullRequestData = devStatusSummaryService.getDetailData(, "subversion", "pullrequest", user).get()


2016-12-13 16:44:44,497 DEBUG [workflow.ScriptWorkflowFunction]:[detail=[],errors=[],configErrors=<null>]

3 votes
Adam Markham [Adaptavist] Community Leader Sep 01, 2016

Your best off tagging your question with com.onresolve.jira.groovy.groovyrunner to get a faster response. Not all of us follow the tags you mentioned or the tags in the questions you linked to.

It sounds like what you want to achieve can be done with a scripted post-function in JIRA. You will then need to call the bamboo REST API via an application link between JIRA and Bamboo to trigger a build. You can find examples here of interacting with other Atlassian applications.

The Bamboo REST API is documented here and the Bitbucket REST API is here.

Its just a case of putting it all together but hopefully this will give you an idea of how to approach this problem.

Mikhail Leonov Sep 01, 2016

Hi Adam, thank you for the response.

Yes, I used scripted post function. Yes, I used application link to communicate with Bamboo. And there are no problems at this point.

The problem is on the issue "parameters", precisely pull-request, branch name, and changeset that available in the development panel(Jira Software). As I mentioned in the question, I see a few ways how to do this, but I don't have enough expertise to find a correct way smile 

1 vote
Mychajlo Chodorev Mar 16, 2018
DevStatusSummaryService devStatusSummaryService = ComponentAccessor.getOSGiComponentInstanceOfType(DevStatusSummaryService.class)

I tried this script but devStatusSummaryService is null. I checked that  plugin com.atlassian.jira.plugins.jira-development-integration-plugin is installed and all its modules are enabled. 

What else can be done?

Mychajlo Chodorev Mar 19, 2018

I've found another way to get instance of DevStatusSummaryService:


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(, "stash", "pullrequest", currentUser).right().get().getDetail()
0 votes
Mikhail Leonov Sep 01, 2016

The similar question was found here and it still without answer sad

0 votes
Mikhail Leonov Sep 01, 2016

Another question with this topic:

Related to Github and Bitbucket Cloud integration. Doesn't helps me smile

0 votes
JamieA Sep 08, 2016

Are you sure it doesn't work for BB server? I think it does.

0 votes
Mikhail Leonov Sep 18, 2016

Hi Jamie,

"dvcsPullRequestService.getPullRequests(["MY_JIRA_ISSUE_ID"])" returns an empty result for my issue linked with Bitbucket server :(

As I understand, dvcs plugin is responsible for connections with Bitbucket cloud and github only.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

151 views 21 9
Join discussion

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