Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

current i am trying create Azure dashboard extension .
i am getting error "
Message: "Error converting value "SELECT [System.Id] FROM WorkItems " to type 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.Wiql'. Path '', line 1, position 36.

while calling the
rest Client api via VSS SDK.

not able to call

error 400 : BAD REQUEST IS showing

i am using VSS.SDK client rest api .

What I have tried:

<!DOCTYPE html>
    <script src="sdk/scripts/VSS.SDK.min.js"></script>
    <script type="text/javascript">
            explicitNotifyLoaded: true,
            usePlatformStyles: true

        VSS.require(["TFS/Dashboards/WidgetHelpers", "TFS/WorkItemTracking/RestClient"], 
            function (WidgetHelpers, TFS_Wit_WebApi) {
                VSS.register("dashboarddemo2", function () {  
                    var context =  VSS.getWebContext()    
                    var projectId =;
                    var teamId =;

                        var GetWorkItems = function (widgetSettings) {
                        debugger;                // Get a WIT client to make REST calls to VSTS                      

                        var queryr = "SELECT [System.Id] FROM WorkItems ";
                        return TFS_Wit_WebApi.getClient().queryByWiql(queryr).then(function (query) {

                                var ty="ddd";
                            // Create a list with query details                                
                            var $list = $('<ul>');
                            $list.append($('<li>').text("Query ID: " +;
                            var $container = $('#query-info-container');
                            return true;
                        }, function (error) {
                        // Use the widget helper and return failure as Widget Status
                        return false;
                        }).catch(err => {
                        }) // TypeError: faile


              return {
                        load: function (widgetSettings) {
                            // Set your title
                            var $title = $('h2.title');
                            $title.text('Hello World');
                          //  debugger;
                            var t2 = GetWorkItems(widgetSettings);
                            return t2;


    <div class="widget">
        <h2 class="title"></h2>
        <div id="query-info-container2"></div>
Updated 8-Oct-20 7:38am
[no name] 5-Sep-20 9:09am    
A garbage collection of return values.
ZurdoDev 8-Sep-20 15:25pm    
That tells me you are passing a string instead of an object.
Siddharth Rai 8-Oct-20 12:22pm    
Sorry for late reply. Problem solve by passing the Object
ZurdoDev 8-Oct-20 13:38pm    
Glad to hear it.

1 solution

As discussed in comments, pass the object instead of a string.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900