How to read the bulit-in attribute value using dojo script in rtc eclipse?
Hi
I am trying to read the built-in attribute value from a workitem (ex : status which is next to the summary attribute). The id of the status field is com.ibm.team.workitem.attribute.state which connected with workflow for the work item type.
I want to read the value of this attribute to do some validation using script based validation in attribute customization, based on the value I need to display error message.
I tried in many way by reading using WorkItemAttributes.STATE as per some solution provided in jazz site, but no luck.
Can any one help with the right set of statements how to read the vale from my build-in field given above.
|
Accepted answer
hi Mohanakrishnan,
MOHANAKRISHNAN CHINNASAMY selected this answer as the correct answer
Comments
Ralph Schoon
commented Nov 07 '17, 8:14 a.m.
| edited Nov 07 '17, 8:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Other than in the question the Status attribute does not have the ID mentioned above com.ibm.team.workitem.attribute.state. The wrong ID com.ibm.team.workitem.attribute.state is caused by https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/219100
MOHANAKRISHNAN CHINNASAMY
commented Nov 07 '17, 8:25 a.m.
Hi Dinesh,
Thanks for your answer. I already tried using that link. but not working. below is my script. Not sure where the mistake is. I am using - workItem.getValue("com.ibm.team.workitem.api.common.WorkItemAttributes.STATE") to get the STATUS of the work item where I am displaying validation error at bottom. But its not providing the status .
return new Status(Severity["ERROR"],workItem.getValue("com.ibm.team.workitem.api.common.WorkItemAttributes.STATE"))
do you have the require on WorkItemAttributes ?
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
Ralph Schoon
commented Nov 07 '17, 10:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The above is not a script. I would suggest doing a step by step following https://jazz.net/library/article/1093 . Providing insufficient parts of the code will only cost everybody time.
MOHANAKRISHNAN CHINNASAMY
commented Nov 08 '17, 1:01 a.m.
Thanks Dinesh and Ralph. I think the issue with declaration. Its working fine with below statements.
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;var workFlowState = workItem.getValue(WorkItemAttributes.STATE);
alert("WorkflowState: " + workFlowState);
You are not supposed to use alert in AttributeCustomization. Use console.log as shown in https://jazz.net/wiki/bin/view/Main/AttributeCustomization .
showing 5 of 6
show 1 more comments
|
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.