I am writing a VSTS dashboard widget used for Work Item Tracking
However I am running into a problem when using the getWorkItem() function. I want to get the ids of all the Features under a given Epic (I already know the epic ID). I am confident that if I set the expand paremeter of getWorkItem() to "All" I will get a list of all the Features and their respective ids. Unfortunately I do not know how to define the "type" of expand parameter and how to properly pass it as a value to the getWorkItem() function.
Here is my code:
VSS.require(["VSS/Service", "TFS/Dashboards/WidgetHelpers", "TFS/WorkItemTracking/RestClient"],
function (VSS_Service, WidgetHelpers, TFS_Wit_WebApi) {
WidgetHelpers.IncludeWidgetStyles();
VSS.register("myapp", function () {
var fetchData = function (widgetSettings) {
const epicID = 123456;
// Get a WIT client to make REST calls to VSTS
return VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient).getWorkItem(123456, null, null, All).
then(
//Successful retrieval of workItems
function (workItems) {
$('#myText').text(JSON.stringify(workItems));
console.log(workItems);
// Use the widget helper and return success as Widget Status
return WidgetHelpers.WidgetStatusHelper.Success();
},
function (error) {
// Use the widget helper and return failure as Widget Status
return WidgetHelpers.WidgetStatusHelper.Failure(error.message);
});
}
Here is the VSTS reference for expand It explains what the values can be, but doesn't say how to pass it into the getWorkItem() function.
I would like to set the optional expand parameter of the function to "All" but don't know its type and how to properly define and use it.