It's all about the answers!

Ask a question

Unable to get calculated attribute working


Adam Holley (2132) | asked Aug 27 '10, 11:21 a.m.
I followed the example on the Wiki.

Under <data>, I have:
<configuration-data xmlns="http://com.ibm.team.workitem/providers" id="com.ibm.team.workitem.configuration.providers">

<valueProviders>
<valueProvider id="exposure" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider" name="Exposure Provider">
<script class="com.example.common.ExposureProvider"/>
<impactAttribute id="riskImpact"/>
<probabilityAttribute id="riskProbability"/>
</valueProvider>
</valueProviders>
</configuration-data>


under <configuration-data xmlns="http://com.ibm.team.workitem/workitemTypes" id="com.ibm.team.workitem.configuration.workItemTypes">, I have:
<customAttributes category="com.ibm.team.workitem.workItemType">

<customAttribute id="riskProbability" name="Risk Probability" type="risk.probability"/>
<customAttribute id="riskImpact" name="Risk Impact" type="risk.impact"/>
<customAttribute id="riskExposure" name="Risk Exposure" type="long"/>
</customAttributes>


under <attributeDefinitions>, I have
<attributeDefinition id="riskExposure" name="Risk Exposure" readOnly="true" type="long">

<valueProvider providerId="exposure"/>
<dependsOn id="riskImpact"/>
<dependsOn id="riskProbability"/>
</attributeDefinition>

under the presentations section, I have:

<section id="com.ibm.team.workitem.section.details">

<presentation attributeId="riskImpact" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskProbability" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskExposure" kind="com.ibm.team.workitem.kind.long"/>
...



under the enumerations, I have:
<enumeration attributeTypeId="risk.probability">

<literal default="true" id="risk.probability.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal id="risk.probability.literal.000" name="0% - Will Not Occur"/>
<literal id="risk.probability.literal.020" name="20% - Highly Unlikely"/>
<literal id="risk.probability.literal.040" name="40% - Unlikely"/>
<literal id="risk.probability.literal.060" name="60% - Probable"/>
<literal id="risk.probability.literal.080" name="80% - Highly Probable"/>
<literal id="risk.probability.literal.100" name="100% - Will Occur"/>
</enumeration>
<enumeration attributeTypeId="risk.impact">
<literal default="true" icon="processattachment:/enumeration/unassigned.gif" id="risk.impact.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.1" name="Very Low"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.2" name="Low"/>
<literal icon="processattachment:/enumeration/medium.gif" id="risk.impact.literal.3" name="Medium"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.4" name="High"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.5" name="Very High"/>
</enumeration>


I uploaded the ExposureProvider.js sample to the attachments for the project area with the path /workitem/scripts/common/ExposureProvider.js

However, when I create a new Task and select a value for Risk Impact and Risk Probability, the exposure does not get updated. Saving doesn't change that. Am I missing something, or is there a way to debug why this is not working?

Thanks in advance.

6 answers



permanent link
Adam Holley (2132) | answered Aug 27 '10, 3:22 p.m.
Some more information. I've found in the jazz.log the error below. Any ideas how to debug this?

2010-08-27 14:16:59,107 ERROR com.ibm.team.workitem.common - Error invoking value provider 'exposure'
org.mozilla.javascript.JavaScriptException: (loader.js#354)
at org.mozilla.javascript.gen.c159._c18(loader.js:353)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1831)
at com.ibm.team.rtc.common.scriptengine.util.JSUtils.dojoRequire(JSUtils.java:123)
...

permanent link
Adam Holley (2132) | answered Aug 27 '10, 4:13 p.m.
Still more information:
In the server/tomcat/work/Catalina/localhost/jazz/eclipse/workspace/.metadata/.log file there is this error:
!ENTRY com.ibm.team.rtc.common.scriptengine 4 0 2010-08-27 15:00:20.388

!MESSAGE Failed to execute script
!STACK 0
org.mozilla.javascript.JavaScriptException: Error: Could not load 'com.example.common.ExposureProvider'; last tried '../com/example/common/ExposureProvider.js' (loader.js#354)
at org.mozilla.javascript.gen.c159._c18(loader.js:353)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)

It doesn't look like it uploaded the ExposureProvider.js file. The only place this file exists on the drive is in the directory I uploaded from. Any idea where this file should be located in the server and why it doesn't upload?
Thanks.

permanent link
Adam Holley (2132) | answered Aug 30 '10, 3:31 p.m.
Solved. I was missing the teamserver.properties update.

permanent link
Raj K (10222125) | answered Nov 03 '10, 9:35 a.m.
Hi,
Is there a way to add a drop down text attribute? Is javascript the way to populate the dropdown? I know exactly how to script in CQ. Can you post how to do this in RTC work items?

Thanks


Solved. I was missing the teamserver.properties update.

permanent link
Pavithra Kasturirangan (42955956) | answered May 22 '12, 9:31 a.m.
Solved. I was missing the teamserver.properties update.


Hi, Even i face the same error as shown above. Could you please tell me what changes have you done to the teamserver.properties file in ccm ?

I tried with

Dcom.ibm.team.repotools.rcp.allowInvalidBundles=true
com.ibm.team.workitem.process.scripts.enabled=true

Still it doesn't seem to recognize the custom advisor.

permanent link
Millard Ellingsworth (2.5k12431) | answered May 22 '12, 12:06 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER
Solved. I was missing the teamserver.properties update.


Hi, Even i face the same error as shown above. Could you please tell me what changes have you done to the teamserver.properties file in ccm ?

I tried with

Dcom.ibm.team.repotools.rcp.allowInvalidBundles=true
com.ibm.team.workitem.process.scripts.enabled=true

Still it doesn't seem to recognize the custom advisor.

Hi, Pavithra.

Could you please start a new thread with details about your issue? Adam's issue seemed to only be missing the property to enable scripts to work. If updating that didn't fix your issue, it may be something else (and we'll need more details to be able to help).

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.