Azure / Azure/azure-cli-extensions

--query not working with azure devops work item fields

Open
#1,266 3 comments 0 reactions 0 assignees View on GitHub
customer-reported DevOps needs-team-attention Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

## Describe the bug
I am attempting to use a JMESPATH filter to bring back just the work item ids and work item titles related to a given Azure DevOps PR. I am able to get the work item ids, but not the title.

The query I am trying to run is `[*].[id, fields."System.Title"]` which, with the appropiate powershell escapes is:
```
[*].[id, fields.`"System.Title`"]
```

Note- if I do not provide a query parameter and save the results to a file ( `az repos pr work-item list > myFile.json` ) and then run a JMESPATH expression over that in visual studio, I get the expected results.

**Command Name**
`az repos pr work-item list
Extension Name: azure-devops. Version: 0.12.0.`

**Errors:**
Does not return expected data

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- _Put any pre-requisite steps here..._
Using powershell
```
$qry = "[*].[id, fields.`"System.Title`"]"
az repos pr work-item list --id 1 --query $qry
```

## Expected Behavior
Returns both the id and title of work items from the pr identified.

```
[
[
3000,
"My title 1"
],
[
4000,
"My title 2"
]
```

## Actual Behavior
Returns the id, but the title is null
```
[
[
3000,
null
],
[
4000,
null
]
```

## Environment Summary
```
Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.67 *

Extensions:
azure-devops 0.12.0

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.