I am trying to get CustomerRequestType name of an issue (that is introduced by Jira Service Desk)
When I get the custom field value of request type like any other custom field, I get a string like "sam/newsoftware". What I need to get is the actual name. Something like "New Software".
Tried autowire. Does not find a suitable cadidate. Tried getting my hands ın CustomerRequestTypeService object through ComponentAccessor. No luck.
Any suggestions about how to get the request type name?
There's a Service Desk class which is able to give you the name (displayed name) of a Customer Request type in JSD: https://docs.atlassian.com/jira-servicedesk/3.9.0/com/atlassian/servicedesk/api/requesttype/RequestType.html
You can use the associated builder from the issue ID to retrieve the associated Requesttype object and use the getName() method:
Hope this helps!
Hi Micky, Thank you.
Looks promising but I couldn't get it to work.
RequestTypeQuery and RequestTypeQuery.Builder are interfaces and mighty Atlassian documentation does not give information about classes who implement this interface. I browsed through the IDE and found a class named RequestTypeQueryImpl. This class is an internal api class (com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeQueryImpl) so I guess it is not meant for our use but also has a static build() method that returns an instance so once again, promising.
The problem is I cannot get that instance. I get a NoClassDefFoundErro exception at runtime. (I am developing on a Jira 7.5 with JSD 3.8.1) Documentation says the class is available in JSD 3.8 or even JSD 3.7 but no luck.
You'll have to use OSGi (https://bitbucket.org/atlassian/atlassian-spring-scanner?_ga=2.103863168.1093982757.1511790277-572295793.1506609124) to inject the RequestTypeQuery object I guess. To be honest I did not try it but should work with an inject. I'm using the PluginLicenseManager interface for my plugin and it's also an interface. Once injected, methods are usable and should give you the ability to use the API :)
Let me know if you manage to get it working!
Thank you for the direction.
The document you sent has instructions for 2.x+ version of Spring Scanner. It turns out my plugin uses the older version so I have several <component-import> statements in my atlassian-plugin.xml file.
I added the interface I need into atlassian-plugin.xml, like ...
<component-import key="requestTypeQueryService" interface="com.atlassian.servicedesk.api.requesttype.RequestTypeQuery"/>
No compile-time errors but when when enabling the plugin on Jira after upload, Jira waits for 300 seconds and I get :
org.springframework.context.ApplicationContextException: Application context initialization for 'blah blah' has timed out waiting for (objectClass=com.atlassian.servicedesk.api.requesttype.RequestTypeQuery)
The same happens for the interface you suggested: RequestType.
Hi Atlassian Community! This is Teresa from the Atlassian team. My colleague Paul Buffington @Buff and I are excited to share a brand new ITSM resource we’ve created – "The Complete Guide to At...
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