How to query for a nonexistent field in WIQL

818 Views Asked by At

I'm trying to get the workitems for which a particular field is empty. I have tried queries like

And [Dell.SDLC.CapabilityID] Not Contains [Any]
And [Dell.SDLC.CapabilityID] Is Empty
And [Dell.SDLC.CapabilityID] = ''

which return 0 results. I believe it's because when the field is not specified, it does not appear at all as one of the fields in the workitem. I have looked at the JSON for a few such workitems and that field is not in it. Is there a way to return all workitems for which a field does not exist?

1

There are 1 best solutions below

0
On BEST ANSWER

When I tested the query, I found if the field is empty, just leave it empty in the query.

For example, please refer the picture below.

There is 6 feature and 4 of them the testsignleline field is empty. enter image description here add the "testsignleline" field empty query. result: enter image description here

In wiql format, this is "SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags], [Custom.testsignleline] FROM WorkItems WHERE [System.TeamProject] = @project and [System.WorkItemType] = 'Feature' and [System.State] <> '' and [Custom.testsignleline] = '' ORDER BY [Custom.testsignleline]"