How to find all work items that were owned by a deleted user

Document ID : KB000047605
Last Modified Date : 14/02/2018
Show Technical Document Details


As long as we can identify one work item, we can get that item's history from Lookback API and discover the deleted user's OID. Then we can use a second LBAPI query to get all items previously owned by the deleted user regardless of current owner.


Lookback API returns historic data, but a query by username does not work. Lookback API can only retrieve snapshots when owner is filtered by ObjectID. We do not have ObjectID of the deleted user.


Find at least one work item that was owned by the deleted user, where the owner has not been reset. In AgileCentral a work item owned by a deleted user shows the deleted user's name as long as the Owner field has not been set to a different user. Here is an example.

Temp User is deleted:

User-added image

We find one work item where this user's Display Name is still shown. Notice Temp user , the past owner of US367 is grayed out. This story does not have a current owner.

User-added image
When we access the details page of US367 the Owner field is empty, even though the summary page shows the grayed out Display Name of the deleted user in the Owner column.

User-added image

This grayed out Display Name provides enough information to find all work items owned by this user using two queries:

Query #1:
get historic data for US367. In the query below we use ObjectID of US367, and make sure to include "Owner" field in the fields clause:{"ObjectID":2884386915}&fields=["FormattedID","_ValidTo","_ValidFrom","Owner"]&removeUnauthorizedSnapshots=true

Here is a screenshot of the result. There are 6 snapshots, and one of them shows the deleted owner's ObjectID:
User-added image
To understand why it works remember that past is unchangeable. At one point in the past this story had the owner, and the corresponding snapshot was created. The fact that the owner was deleted later does not alter the pre-existing snapshot.

Query #2:
Now that we have the ObjectID of the deleted user we can query on all workitems that this user used to own:{"Owner":12845051329}&fields=["FormattedID","ObjectID","_ValidTo","_ValidFrom","Owner"]&removeUnauthorizedSnapshots=true

Here is a screenshot of the result. There are two more work items previously owned by this user: DE672 and DE673. Note that even if these defects have a new owner, the results of this query will not be changed.

User-added image