Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to access DevStatus from JMCF

aedu
Contributor
March 15, 2019

hi,

i tried to access the details of pull request assigned to an issue.
the following code get an NPE ... any ideas?

import com.atlassian.jira.plugin.devstatus.api.DevStatusSummaryService

def devStatusSummaryService = getComponent(DevStatusSummaryService)
def pullRequestData = devStatusSummaryService.getDetailData(issue.id, "stash", "pullrequest", currentUser).get()


NPE:
java.lang.NullPointerException: Cannot invoke method getDetailData() on null object

thanks, adrian

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
March 15, 2019
aedu
Contributor
March 18, 2019

thanks for this link.

but at the end of the solution it's written: "I accessed everything i need through REST API". is there a way to call the REST API from JMCF with the credentials of current user?

David Fischer
Community Champion
March 18, 2019

Calling the REST API from a calculated field is really not a good idea, because it will have a significant impact on performance, especially during re-indexing.

It would be much better to ask Atlassian for the replacement API to the DevStatusSummaryService.

Mehmet Sari December 2, 2021

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