tfsscrumkanbanbacklogscrumboard

Getting Kanban throughput data from Microsoft VSO


I'm creating a throughput calculator for my team based on our data in the MS VSO tool. In order to accurately indicate the date we start work on a PBI I need to extract the date a PBI is committed to.

Is it possible to query the MS VSO product in order to extract the dates that a PBI changed state to "Committed"?

I can get "Created Date" via the query editor (column options only I'm afraid), but VSO doesn't seem to allow access to the state change dates. And start date isn't correct, as the PBI may have been kicking around in the backlog for some time before it's Dev ready.


Solution

  • Cannot achieve that with the query by default.

    But you could query the work item history with the TFS API and check the timestamps on when the state transitions occurred.

    Refer to this article to do that : TFS SDK: Work Item History Visualizer using TFS API

    You can also use the REST API to extract the dates that a Work item changed state.

    For example, you can use below PowerShell sample to get the date changed to "Committed":

    Param(
       [string]$collectionurl = "https://instance.visualstudio.com",  #If on-premise TFS change it to http://server:8080/tfs/DefaultCollection
       [string]$workitemId = "62",
       [string]$user = "username",
       [string]$token = "token"
    )
    
    # Base64-encodes the Personal Access Token (PAT) appropriately
    $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
    
    $baseUrl = "$collectionurl/_apis/wit/workitems/$($workitemId)/revisions?api-version=1.0"            
    $response = (Invoke-RestMethod -Uri $baseUrl -Method Get -UseDefaultCredential -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)})
    $revisions = $response.value.fields | where({$_.'System.State' -eq 'Committed'}) # Change the sate which you want to get it's changed date here 
    
    $witrevisions = @()
    
    foreach($revision in $revisions){
    
        $customObject = new-object PSObject -property @{
              "WorkItemType" = $revision.'System.WorkItemType'        
              "CommittedDate" = $revision.'System.ChangedDate'
              "ChangedBy" = $revision.'System.ChangedBy'
            } 
    
        $witrevisions += $customObject      
    }
    
    $witrevisions | Select-Object -Last 1 `
                    WorkItemType,
                    CommittedDate, 
                    ChangedBy
    

    enter image description here