It's all about the answers!

Ask a question

Custom calculated attribute not working

Carson Holmes (11113541) | asked Nov 27 '12, 7:56 p.m.
I'm brand new to attribute customization, and am trying to get a test to work.

Here is the javascript:


(function() {
    dojo.declare("com.fmc.TestProvider", null, {

        getValue: function(attribute, workItem, configuration) {

return "test";

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.

Brian Fleming commented Nov 27 '12, 10:03 p.m.

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?

Accepted answer

permanent link
Ralph Schoon (62.7k33643) | answered Nov 28 '12, 1:23 a.m.
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 which has the link to 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 , and 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: 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

Carson Holmes commented Nov 28 '12, 11:04 a.m.

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 Eclipse client.

Ralph Schoon commented Nov 28 '12, 11:31 a.m.

You have to point the mouse pointer over the icon of the type. Point it anywhere else - no synchronize attributes 8-)

Carson Holmes commented Nov 28 '12, 11:43 a.m.

Thanks!  Talk about cool "hidden" features...  Great article series btw. 

Carson Holmes commented Nov 28 '12, 12:47 p.m.

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?

Ralph Schoon commented Nov 28 '12, 6:15 p.m. | edited Nov 28 '12, 6:48 p.m.

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.

What do you want to achieve?

Carson Holmes commented Nov 28 '12, 6:26 p.m.

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"?

Ralph Schoon commented Nov 28 '12, 6:50 p.m.

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? 

Carson Holmes commented Nov 28 '12, 7:38 p.m.

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.

Ralph Schoon commented Nov 29 '12, 2:07 a.m. | edited Nov 29 '12, 3:16 a.m.

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 carefully

Dependent Attributes

Carson Holmes commented Nov 29 '12, 10:42 a.m.

Aahh, ok.  Thanks I was missing that piece of the puzzle. 

showing 5 of 10 show 5 more comments

Your answer

Register or to post your answer.