Custom calculated attribute not working
![]()
I'm brand new to attribute customization, and am trying to get a test to work.
Here is the javascript:
I have added it to Attribute Customization as a Calculated Value.
I have added this custom attribute as an attribute to the Task WI as "readonly".
I have created a custom Editor Presentation for the Task WI to show the new attribute.
I am having the following issues:
1) I can't get it to show up in the Editor Presentation (I made some other changes that did take effect, so I know I'm in the right place).
2) I can get the new "test" attribute to show up in queries, but it has no value. I've tried to update a work item and save it, but it still shows no value in the query.
Any advice is greatly appreciated. |
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Nov 28 '12, 1:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Nov 28 '12, 1:32 a.m.
Hi Carson,
new attributes don't show up on old work items. You have to create a new work item of the type to get them. They might appear as read only in case they show. You need to "Synchronize Attributes" see http://rsjazz.wordpress.com/2012/11/19/using-an-expression-to-synchronize-attributes-for-work-items-of-a-specific-type/ which has the link to https://jazz.net/library/article/529 which talks about how to do that in the Eclipse UI, if you want to see them in work items created be fore the attribute was added.. Please see https://jazz.net/library/article/1003 , https://jazz.net/library/article/130 and https://jazz.net/library/article/1093 for more information. We hope to be able to ship the labs on scripting in the last article soon. If you synchronize the attributes or create a new work item, please check the logs if the scripting is enabled and runs as described here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization if you don't see the default value in queries. There is too few data on why the attribute does not show in the presentations. If you don't change them, you should at least see it in the custom tab of the eclipse work item editor. If it shows, start from there to get it into an editor presentation and be aware there are different ones for planning, creating work items as well as the work item editor itself. Carson Holmes selected this answer as the correct answer
Comments Thanks Ralph, very helpful. I don't see the option to synchronize attributes. Do I need to be a JazzAdmin to do this? On this server I'm only a JazzProjectAdmin. This is the 4.0.0.1 Eclipse client. ![]() ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You have to point the mouse pointer over the icon of the type. Point it anywhere else - no synchronize attributes 8-)
Thanks! Talk about cool "hidden" features... Great article series btw. Sorry one more question on this thread:
Once I've synchronized the attributes, if I make a change to the javascript for the calculated column, a second synchronization doesn't seem to function on rows already synchronized. I've tried removing the attribute altogether from the WI type with thoughts of re-adding it, but it still shows in the query list of columns... Any suggestions?
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Your calculated value would have to trigger on a change to something. Try to make it dependent on a change such as a state or open and save the work item. The synchronization would only do something (change something) if the attribute is note present.
I was assuming it would recalculate anytime the WI was saved. Do I have to configure a trigger using a follow-up action in Operational Behavior for "Save Work Item"? Why would it save the work item if nothing changes? I would not expect a synchronize to change the work item if there are no new attributes. Does it work on manual changes?
The project team wants a Percent Complete column on the WI based on Time Spent / Estimate (or Corrected Estimate if supplied). So I need to trigger a recalc when one of these columns are changed. ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You need to add the attributes that are supposed to trigger the update to the list of dependent attributes in the Types And Attributes section to the attribute that is supposed to be updated. Please read https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values carefully
Aahh, ok. Thanks I was missing that piece of the puzzle.
showing 5 of 10
show 5 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.
Comments
The script is fine and it works for me. Have you tried adding the new attribute to an existing editor presentation to see if it will appear? Can you provide more details on the new editor presentation you created? What is the tab's layout? What slot in the section did you add the attribute to? Can you get other attributes to appear in the same tab/section?