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:
Hi,

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
.queryByWiql
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>
<html>
<head>    
    <script src="sdk/scripts/VSS.SDK.min.js"></script>
    <script type="text/javascript">
        VSS.init({
            explicitNotifyLoaded: true,
            usePlatformStyles: true
        });

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


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

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

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

                        }
                    }
                });
            VSS.notifyLoadSucceeded();
        });       
    </script>

</head>
<body>
    <div class="widget">
        <h2 class="title"></h2>
        <div id="query-info-container2"></div>
    </div>
</body>
</html>
Posted
Updated 8-Oct-20 7:38am
Comments
[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