RTC: how to retrieve work item type "name" via Java API
![]()
Is it possible to retrieve, via Java API, the "user-readable" type name of a work item?
I mean: suppose you have a Project Change Request. Its type is "projectchangerequest" (as it is retrieved from the workItem.getWorkItemType() method; this is the work item type "id"), but, on the form, it is displayed as "Project Change Request" (this is the work item type "name"). I need to retrieve this "name", but I cannot figure out how. Any suggestions? My RTC version is 4.0.6 |
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Dec 05 '14, 10:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
IWorkItemType.getDisplayName() ?
Luca Martinucci selected this answer as the correct answer
|
3 other answers
![]()
Hi Luca,
I tried to get workitem id and set into one of attribute using below script but it is not working. Please correct me if it is wrong script. FYI, dojo.provide("workitemtype"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); // To access the work item attributes dojo.require("com.ibm.team.workitem.api.common.Status"); // To create a status object to return dojo.require("com.ibm.team.workitem.api.common.Severity"); // To create a severity for the status (function() { dojo.declare("workitemtype", null, { getValue: function(attributeId, workItem, configuration) { IWorkItem workItem = .....; String workItemTypeID = workItem.getWorkItemType(); return workItemTypeID; } }); })(); Thanks, Rajiv Comments Rajiv, it looks like you are writing a Javascript attribute customization.
Please file your own question next time, as this is already closed and for Java API. Thanks.
Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management
From the first link you get that the JavaScript API syntax is: workItem.getValue(WorkItemAttributes.TYPE); |
![]()
Thanks to both of you.
workItem.getValue(WorkItemAttributes.TYPE); this method is working fine and it has full filled my requirement |
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.