Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

How to access DevStatus from JMCF

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

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?

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.

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

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