Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Configuration of Script Based Calculated Value

Hi,

I'm using RTC 3.0.1.1 and trying to set up a script based calculated value for a custom attribute on a work item. I've uploaded the javascript file containing the getValue function to the project's attachments (on the project area's Links tab), added a Calculated Values entry to the Attribute Customization section of the Process Configuration, and added the attribute and the one it's calculated from to the editor presentation. However, when I create a new work item, the calculated value isn't being updated when I change the value of the Dependency. When I tried it via the web interface, changing the value produced a dialog box saying "".

One thing I did notice that was different from the screenshots in the Attribute Customization wiki page was that in the Attribute Customization instead of the fields for Local File Path etc. I just have a message "No Configuration UI available. You may want to edit the configuration on the Process Configuration Source tab."
In the source I did find a corresponding
<configuration-data final="false" id="com.ibm.team.workitem.configuration.providers" xmlns="http://com.ibm.team.workitem/providers">

<valueProviders>
<valueProvider id="com.ibm.team.workitem.valueproviders.VALUE_PROVIDER._LH77cDXzEeGRvtlfT8yf3Q" name="ComplexityDescription" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider"/>
</valueProviders>
</configuration-data>

entry, and I'm guessing this needs amending to actually link it to the javascript file I uploaded. But what's the required syntax for that? Based on an example in another forum post, I tried adding a nested element to the valueProvider
<script class="my.workitems.providers.IRComplexityDescription"/>

(the class from the dojo.provide & dojo.declare calls in the javascript file) but that didn't make any difference.

Any suggestions what I'm missing for this to work?


Andy.

0 votes



5 answers

Permanent link
Hmm... Thought I was getting somewhere for a moment.
I found a different example to copy; replacing the script line with
<script class="my.workitems.providers.IRComplexityDescription" path="/workitem/scripts/IRComplexityDescription.js"/>

(i.e. adding the attribute with the path I uploaded the file to) I stopped getting the javascript error dialog in the browser client. Unfortunately, the calculated field still wasn't being updated.
Running it in the eclipse client, I saw the following in the .log file:
org.mozilla.javascript.JavaScriptException: Error: Could not load 'my.workitems.providers.IRComplexityDescription'; last tried '../my/workitems/providers/IRComplexityDescription.js' ({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"}#414)

and I didn't see any messages for the console.log calls I'd added. Does it *have* to be uploaded to the location suggested by the package structure, or is the path="..." supposed to allow dojo's loader to get it from the alternative location? I even tried uploading the attachment at /my/workitems/providers/IRComplexityDescription.js, but still got similar errors in the log.


Andy.

0 votes


Permanent link
Hmm... Thought I was getting somewhere for a moment.
I found a different example to copy; replacing the script line with
<script>

(i.e. adding the attribute with the path I uploaded the file to) I stopped getting the javascript error dialog in the browser client. Unfortunately, the calculated field still wasn't being updated.
Running it in the eclipse client, I saw the following in the .log file:
org.mozilla.javascript.JavaScriptException: Error: Could not load 'my.workitems.providers.IRComplexityDescription'; last tried '../my/workitems/providers/IRComplexityDescription.js' ({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"}#414)

and I didn't see any messages for the console.log calls I'd added. Does it *have* to be uploaded to the location suggested by the package structure, or is the path="..." supposed to allow dojo's loader to get it from the alternative location? I even tried uploading the attachment at /my/workitems/providers/IRComplexityDescription.js, but still got similar errors in the log.


Andy.

Hi,
Try enabling CCM advance property: Enable Process Attachment Scripts and resubmit the script ... worked for me :D

Cheers

0 votes


Permanent link
Below is an example of one of our calculated value scripts. How are you uploading the script if the local path option isn't available?

On the Links tab does your script appear under attachments? How it's listed there is what matches my path value in the config source for the script.


<valueProvider id="com.ibm.team.workitem.valueproviders.VALUE_PROVIDER._hOfOMLaDEeCu-tc-Mw78tA" name="OwnerUpdate" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider">
<script class="org.example.APAROwner" path="/workitem/scripts/common/APAROwner35.js"/>
</valueProvider>

0 votes


Permanent link
Below is an example of one of our calculated value scripts. How are you uploading the script if the local path option isn't available?


Links tab -> Attachments, and the Add/Replace buttons.
Because the Configuration section of Attribute Customization was unavailable, I followed the suggestion in the message it was displaying - "No Configuration UI available. You may want to edit the configuration on the Process Configuration Source tab." - so I'm editing the Source...

On the Links tab does your script appear under attachments?


Yes.

How it's listed there is what matches my path value in the config source for the script.

<valueProvider id="com.ibm.team.workitem.valueproviders.VALUE_PROVIDER._hOfOMLaDEeCu-tc-Mw78tA" name="OwnerUpdate" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider">
<script class="org.example.APAROwner" path="/workitem/scripts/common/APAROwner35.js"/>
</valueProvider>


Okay, I've tried one like that and it still wasn't working, so I guess the problem's not my config but elsewhere. I suspect the Enable Process Attachment Scripts setting isn't actually enabled, and that's why the Configuration section appears empty in the first place, but since I'm not a JazzAdmin in our installation I'm waiting on another team to check and let me know...

Thanks for the help.

Andy.

0 votes


Permanent link
I still haven't heard back about the server setting, but managed to get it working in the meantime. The problem turned out to be due to the path the file was in - even though the upload location and the config entry matched, thanks to a typo they weren't actually under /workitem/scripts/common and other ones I'd tried (e.g. /workflow/scripts) hadn't worked either. Once located in /workitem/scripts/common, the calculated value started working correctly, in both desktop and web clients :-)


Andy.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jan 03 '12, 7:31 a.m.

Question was seen: 9,306 times

Last updated: Jan 03 '12, 7:31 a.m.

Confirmation Cancel Confirm