Get non built-in attribute values from javascript
Marco Delato (51●21●14)
| asked Jul 10 '12, 12:24 p.m.
edited Jul 10 '12, 2:55 p.m. by Jared Burns (4.5k●2●9)
How to get Custom Attribute values from Javascript?
In the https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_Example wiki there is the list of the constants that can be used to get Workitem built-in attributes. In https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples#Get_an_item_s_UUID_users_iterati is shown how to create a custom attribute to store - for instance - UserName. The value of the custom attribute is automatically calculated by the attribute OwnenBy (of the workitem) and can be "Use(d) this id in other scripts that need to identify this particular user" How to get the value of this new (custom) attribute from other scripts? Thanks in advance, Marco Delato |
One answer
Millard Ellingsworth (2.5k●1●24●31)
| answered Jul 10 '12, 3:53 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER
When you create the custom attribute, take note of the ID value you assign it and use that in the workItem.getValue() call (rather than use one of the built-in IDs defined in WorkItemAttributes.*).
For example, I created a custom attribute named customAttribute1 (a small string) and set its ID value to "edu.millard.customattribute1". To retrieve it in JavaScript, I just used: var customAttr1 = workItem.getValue("edu.millard.customattribute1");
|
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.