Forums

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

Get Issue Type

Chris Kaliveas July 11, 2019

Hi,

I'm having difficulty getting issue type name in Jira Cloud Scriptunner Post Function.  Any help would be great.

Cheers,

Chris

 

// get custom fields
def issueKey = issue.key

def customFields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>


def v_issue_type_id = customFields.find { it.name == 'Type' }?.id
def v_issue_type_id2 = issue.fields[v_issue_type_id] as String


// Get issuetype
def get_issuetype = get('/rest/api/2/issuetype/' + v_issue_type_id2)
.header('Content-Type', 'application/json')
.asObject(Map)

def v_issue_type_id3 = get_issuetype.body.name as String

1 answer

0 votes
Antoine Berry
Community Champion
July 12, 2019

Hi @Chris Kaliveas ,

how would the straight forward work ?

issue.getIssueType().getName()

Suggest an answer

Log in or Sign up to answer