how to get the custom field attribute value in value set provider script
i am trying to display the name of attached files in a custom field(generic combo) in a work item.
so i created a value set script
if i directly give the work item id it perfectly works , but how to make it generic so that when i open a work item its displays only the attached files belonging to the opened work item ,
dojo.provide("com.example.ValueSetProvider33");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.ValueSetProvider33", null, {
getValueSet: function(attributeId, workItem, configuration){
{
var params= new com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters();
var ID = workItem.getValue(WorkItemAttributes.ID);
params.xpath= "//Collection/Attachment";
params.columnXpaths= ["./title"];
params.columnIds= ["title"];
params.ignoreInvalidCertificates=true;
params.useOAuth=true;
var connector= configuration.getDataConnector("HttpConnector");
var values= connector.get(params);
var result= [];
while(values.hasNext()){
var entry= values.next();
var wiIDs= entry.getById("title");
result.push(wiIDs);
}
return result;
}
});
})();
One answer
As of https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript the ID of the work item is WorkItemAttributes.ID or "id".