Forums

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

request types in post function emails

Robin Weiß December 7, 2018

Hi,

I'd like to send an email to my service-desk team including the name of the request type of the created ticket. 

We are using SriptRunner for post function emails.

I already tried it with:
<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10207")) %>

But this only returns a weird kind of string. ("ps/9e37bfa9-df0b-434e-b6eb-1bc7314b1fc3")
The .toString() Method returns the same.

Has some one an idea how I can access the "real" name of the request type ("IT-Support" i.e.)? 

Thanks for yo

1 answer

0 votes
Matthias Gaiser _K15t_
Community Champion
December 7, 2018

Hi @Robin Weiß,

you might want to have a look at this question which also lists some Scriptrunner script how to access the request type:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

@WithPlugin("com.atlassian.servicedesk")
def requestTypeService = ComponentAccessor.getOSGiComponentInstanceOfType(RequestTypeService)
def reqQ = requestTypeService.newQueryBuilder().issue(issue.id).build()
def reqT = requestTypeService.getRequestTypes(currentUser, reqQ)
def requestType = reqT.right.results[0].getName()

You can also check Atlassian's docs about the RequestTypeService to see if there is another method which you want to use.

Cheers,
Matthias.

Suggest an answer

Log in or Sign up to answer