Get non built-in attribute values from javascript
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
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
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");