It's all about the answers!

Ask a question

How to get severity name??


faith chen (115) | asked Dec 05 '19, 11:26 p.m.

Hello 


 
i will try workItem.getSeverity() and return identifier

but, i want get name ex(major)

3 answers



permanent link
Bharath Rao (915136) | answered Dec 05 '19, 11:37 p.m.

 Hi,


You could refer the below link on getting attribute values under "Getting the Work Item’s Attributes in the API"

Regards,
Bharath


permanent link
Luca Martinucci (1.0k294112) | answered Dec 06 '19, 2:30 a.m.
If you are working with server-side Java API, try this code.
I've used it to retrieve the values of many enumeration attributes; it should work for the Severity attribute as well:

IAttribute attribute = ...;
Identifier<?> enumerationIdentifierValue = ...;
IWorkItemCommon workItemCommon = ...;
IProgressMonitor monitor = ...;
String identifierName = "";

while (identifierName.isEmpty()) {
IAttributeHandle attributeHandle = (IAttributeHandle) attribute.getItemHandle();
IEnumeration<?> enumeration = workItemCommon.resolveEnumeration(attributeHandle, monitor);
List<?> literals = enumeration.getEnumerationLiterals();
for (Iterator<?> literalsIterator = literals.iterator(); literalsIterator.hasNext();) {
ILiteral iLiteral = (ILiteral) literalsIterator.next();
if (iLiteral.getIdentifier2().toString().equals(enumerationIdentifierValue.toString())) {
identifierName = iLiteral.getName();
break;
}
}
}

permanent link
faith chen (115) | answered Dec 06 '19, 2:47 a.m.

 

thanks

i will try get customer attribute name

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.