It's all about the answers!

Ask a question

Trying to autopopulate date and time in a custom date attribute


nannette Mori (50575) | asked Jun 30 '15, 11:54 a.m.

In trying to get the work item attribute the return result is "null"

dojo.require("com.Ibm.team.wrkitem.api.common.workItemAttributes);

Var WorkItemAttributes=com.ibm.team.workitem.api.common.workItemAttributes

get value: funtion (attribute,workitem, configuration)

var return result = workItem.getvalue(attribute);

at this point what is being returned in the return result is "null" not the id of the attribute

Can you tell me what I am doing wrong?  Thanks for your assistance!


Comments
Ralph Schoon commented Jul 01 '15, 4:41 a.m. | edited Jul 01 '15, 4:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

A null indicates that the attribute with the ID passed in attribute is not set or the ID is not valid.

One answer



permanent link
Brian Fleming (1.6k11928) | answered Jun 30 '15, 12:34 p.m.
Check the sample scripts here:
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript

I don't think you're passing in a valid argument to workItem.getValue() (and you are using a lowercase "v" in your method call).  You should be passing in the id of the attribute whose value you want returned or one of the built-in attributes like WorkItemAttributes.SEVERITY (full list here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of)

Comments
nannette Mori commented Jun 30 '15, 2:13 p.m.

this is a custom attribute so how do I know what the attribute ID is


Ralph Schoon commented Jun 30 '15, 3:01 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Consider going through

there are numerous examples. The code above is too incomplete to say anything.


Brian Fleming commented Jun 30 '15, 3:27 p.m.

When the attribute was created, an ID had to be specified.  You can determine the id by opening the Project Area process specification in Eclipse, navigating to Project Configuration -> Configuration Data -> Work Items -> Types and Attributes, finding the attribute in question, double clicking it to bring up the "Edit Custom Attribute" dialog and using the value in the "ID" field.  


Ralph Schoon commented Jul 01 '15, 4:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please also see https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript ans search for Timestamp for how to deal with the conversions needed.

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.