Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get IssueLinkTypeID from IssueLinkName in API

Graeme Mitchell October 21, 2013

Should hopefully be a simple one - How do I get the issue link type ID from the issue link type name using the standard API. For example, if I want to retrieve the link type ID from the link called "Duplicates"

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2013
Graeme Mitchell October 21, 2013

Thanks! For reference to anyone else, this is the code I built for my particually scenario using the above answers a guide. Note that this is currently un-tested, but if it doesn't work I will come back and change the answer where necessary

String issueLinkName = "Code Block";
		long issueLinkTypeId;
					
		Iterator<IssueLinkType> issueLinkTypes = ((IssueLinkTypeManager) ComponentAccessor.getComponentOfType(IssueLinkTypeManager.class)).getIssueLinkTypesByName(issueLinkName).iterator();
		Boolean foundIssueLinkType = false;
		
		if (issueLinkTypes.hasNext())
		{
			IssueLinkType issueLinkType = issueLinkTypes.next();
			
			issueLinkTypeId = issueLinkType.getId();
		}
		else
		{
			throw new Exception("Could not find '" + issueLinkName + "' issue link type");
		}

Like Loïc Dewerchin likes this
TAGS
AUG Leaders

Atlassian Community Events