It's all about the answers!

Ask a question

Scripted Value Provider to limit Category-typed attributes in RTC


June Boston (1941637) | asked Apr 10 '18, 6:50 p.m.

Hello,
We need to configure a value set provider that limits the content of the Categories; we will use this on both our Filed Against attribute as well as several other Category-based attributes.  We're pulling the info from a REST call to RTC.  While I can configure an HTTP Value Set Provider to return a set of results, you cannot use an HTTP Value Set Provider with a Category-based attribute (it doesn't appear as an option in the dropdown on the config).  You also cannot use Dependent Enumerations with them.  I have written a script to try and do it as you can select a script-based value set for Filed Against and other Category attributes.  I do not know if this will actually work as I do not know what value to return; would it be the name, id, itemId, or some other value that should come back?

dojo.provide("com.zions.valuesetprovider.categoryfilteralpha");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters");

(function() { dojo.declare("com.zions.valuesetprovider.categoryfilteralpha", null, { getValueSet: function(attributeId, workItem, context){ console.log("Going to do the parameters now"); var params= new com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters(); params.url= "https://clm.cs.zionsbank.com/ccm/rpt/repository/workitem?fields=workitem/category[projectArea/itemId=_TofgQPfREeOpj9QcDboLoA]/*"; params.xpath= "//workitem/category"; params.columnXpaths= ["./id"]; params.columnIds= ["id"]; params.ignoreInvalidCertificates=true; params.useOAuth=true;

        var connector= context.getDataConnector("HttpConnector");
        var values= connector.get(params);
        console.log("length of returned values: " + values.length);
        /* none of my console logs ever show up for this script */
        var result= [];
        while(values.hasNext()){
            var entry= values.next();
            var getPushed= entry.getById("id");
            result.push(getPushed);
        }
        return result;
    }
});

})();


I have enabled debugging but the console isn't showing any feedback from my script, hard to tell if it's taking well.  I could easily change the params.columnXpaths to have this return any of the values in the XML result.
Link to see XML REST results in your own system:
https://<clm uri here>/ccm/rpt/repository/workitem?fields=workitem/category[projectArea/itemId=<project id here>]/*

2 answers



permanent link
Ralph Schoon (59.4k23642) | answered Apr 11 '18, 2:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

June,

the JavaScript API is fairly limited. If you look into https://jazz.net/wiki/bin/view/Main/AttributeCustomization you will realize that support for attribute types is pretty much limited to simple types like strings and single value enumerations.

I tried to summarize what I found here https://rsjazz.wordpress.com/2016/07/15/rtc-process-customization-what-you-can-and-cannot-do/

If the HTTP filtered value set does not work the only  available option is Java. See https://rsjazz.wordpress.com/?s=attribute+customization for examples.

Debugging, you can try logging in the script if you can not debug it, see https://jazz.net/library/article/1093 last lab for hints around debugging and logging.


permanent link
Donald Nong (14.4k314) | answered Apr 11 '18, 3:30 a.m.

The said value set provider is executed on the server side, therefore the logging is in the ccm.log file, but not the browser console.

Your answer


Register or to post your answer.