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

Jira 8 ServiceDesk 4 Scritrunner - getrequesttype in listener

I have the following code that worked before upgrading to Jira 8/ServiceDesk4 but now it does not and I have not been able to find a replacement for this. This is in a listener and I am just needing to get the request type.

 

def requestTypeEither = ComponentAccessor.getOSGiComponentInstanceOfType(RequestTypeService).getRequestTypes(curUser,sourceIssueRequestTypeQuery)

if (requestTypeEither.isLeft()) {
log.error "${requestTypeEither.left().get()}"
return
}
def requestType = requestTypeEither.right.results[0]

 

What is the new method?

 

2 answers

1 accepted

0 votes
Answer accepted

Finally figured it out. 

Have to change:

def requestType = requestTypeEither.right.results[0]

to:

def requestType = requestTypeEither.results[0].getName()

Mean to include, the error i'm getting is:

groovy.lang.MissingPropertyException: No such property: right for class: com.atlassian.servicedesk.api.util.paging.PagedResponseImpl at Script171.run(Script171.groovy:38)

Same problem here, did you solve it?

seems like there has been some changes, in my former code I supposed

com.atlassian.servicedesk.api.requesttype.RequestTypeService.getRequestTypes to return a
com.atlassian.fugue.Either 

 so this faild although it was working before:

def requestTypes = requestTypeService.getRequestTypes(currentUser, requestTypeQuery)

return (requestTypes?.right?.results[0]?.getIssueTypeId()).toString()

 

just changed it to something like:

requestTypes?.findFirst()?.get()?.name

or

requestTypes?.each{ ... }

 

regards.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

841 views 5 22
Read article

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