It's all about the answers!

Ask a question

Script Based value set


Marco Delato (512114) | asked Jun 28 '12, 12:25 p.m.
Hi,
I'm trying to define a Script Based Value Set on RTC v 3.0.1.3.
I set the configuration entry:
com.ibm.team.workitem.process.scripts.enabled=true
I'm following the instructions at https://jazz.net/wiki/bin/view/Main/AttributeCustomization.

I'm using the following script:

dojo.provide("org.example.workitems.providers.ValueSetSkeleton");

(function() {
dojo.declare("org.example.workitems.providers.ValueSetSkeleton", null, {

    getValueSet: function(attributeId, workItem, configuration) {
        var result= [];
        result.push("projetto 1");
        result.push("projetto 2");
        return result;
    }
});
})();

I'm working on an eclipse RTC client.

When I try to retrieve entries (during a New WorkItem operation) I get the following error (on an eclipse windows popup):
Error during 'Receiving values for attribute 'XXXX''

For input string: " "path":"resources\\_base\\_loader""

How to avoid that error?

Marco

3 answers



permanent link
Dinesh Kumar B (4.1k413) | answered Jun 29 '12, 2:25 a.m.
JAZZ DEVELOPER
the above piece of code you have works for me using below steps:
1.  Create a placeholder enumeration with one dummy literal
2.  Create a valueset and modify the configuration source under configuration data to point to the js

</configuration-data>
</valueSetProviders>
<valueSetProvider id="com.ibm.team.workitem.valueproviders.VALUE_SET_PROVIDER._BTywUMGqEeG_v-3lEjcZoQ" name="ScriptSet" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider">
<script class="org.example.workitems.providers.ValueSetSkeleton" path="/workitem/scripts/common/ValueSetSkeleton.js"/>
</valueSetProvider>
</valueSetProviders>
</configuration-data>

The path here refers to the attachment path from the Links --> Attachments section
           
3.  Create an attribute under my new workitem type and use the enumeration as its type
I dont still set the value set property. 
Perform a Synchronize Attributes

4.  Set the valueset on the Attribute

5.  Add the presentation and the returned values from the script show up under the enum attribute drop down both in eclipse and web ui

From the error, I suspect the path mentioned in the configuration source is not same as the one you mentioned for the js in the Links --> Attachments

permanent link
Marco Delato (512114) | answered Jun 29 '12, 10:56 a.m.
Hi Dinesh,
your answer is fine, and I solved my problem, thanks a lot!

As I read on the tutorial at https://jazz.net/wiki/bin/view/Main/DataSourceValueSetProviders wiki I set the type of attibute as medium string, you told me to set it as enumeration. Your soultion works fine.
Is the above tutorial wrong?

Thanks,
Marco

permanent link
Dinesh Kumar B (4.1k413) | answered Jul 02 '12, 11:24 a.m.
JAZZ DEVELOPER
Hi Marco,

The wiki link DataSourceValueSetProviders creates an extension point and modifies the configuration source to indicate the attribute types for which the extension applies to.  More over, it makes use of HTTP Content Providers.  What I suggested above is probably a workaround to the extension based implementation.  I feel, if the complete steps suggested in the wiki is followed, you should be able to get it running with string types as suggested there.
In short the steps would be :
1.  Create the implementation which extends specific extension points based on browser/client needs. 
2.  Modify the config source as mentioned to include the attribute types it has to apply to
3.  deploy /provision the script on to the server
for the provisioned extensions to take effect, the server might have to be restarted.

Hope this helps.

I will try the link and update my observations here if it does not work for me too..

Regards,
Dinesh

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.