Hi Nik,
1. I query for SchedulableArtifact, which contains user story, defects, testsets etc. But I think it does not really matter.
2. Of the query result "
attriList ", it is a Json file. And I found the "Tasks" key, but its corresponding value only contains "_ref", "_type", "count". I think that's why "
Query("Tasks.Name", Query.Operator.Equals, userRef);" does not work
|
Name |
Value |
Type |
◢ |
[9] |
{[Tasks, Count = 5]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
Key |
"Tasks" |
string |
|
◢ Value |
Count = 5 |
object {System.Collections.Generic.Dictionary<string, object>} |
|
▶ [0] |
{[_rallyAPIMajor, 2]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
▶ [1] |
{[_rallyAPIMinor, 0]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
▶ [2] |
{[_ref, https://rally1.rallydev.com/slm/webservice/v2.0/Defect/354696432436/Tasks]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
▶ [3] |
{[_type, Task]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
▶ [4] |
{[Count, 2]} |
System.Collections.Generic.KeyValuePair<string, object> |
|
▶ Raw View |
|
|
3. The word "it doesn't work", I mean I didn't get error message or warnings. But based on the returned result, It does not match this query "
Query("Tasks.Name", Query.Operator.Equals, userRef)", which is that if one defect contains my tasks but its/defect owner is not me(task owner is me), this defect is not located.
4. What I feel confused is that I did notice the request when I inspect the web source and find the query below. Why does it work while it does not when I use .Net tool Kit?
query:
((((((TypeDefOid = 27397600856) AND
((((((Tasks.Owner = "/user/184803097156")
AND (Tasks.ObjectID != null)) OR
((Defects.Owner = "/user/184803097156") AND
(Defects.ObjectID != null))) OR
((Children.Owner = "/user/184803097156") AND
(Children.ObjectID != null))) OR
((TestCases.Owner = "/user/184803097156") AND
(TestCases.ObjectID != null))) OR
(Owner = "/user/184803097156"))) OR
((TypeDefOid = 27397600831) AND
((((Tasks.Owner = "/user/184803097156") AND
(Tasks.ObjectID != null)) OR
((TestCases.Owner = "/user/184803097156") AND
(TestCases.ObjectID != null))) OR
(Owner = "/user/184803097156")))) OR
((TypeDefOid = 27397600871) AND
((((Tasks.Owner = "/user/184803097156") AND
(Tasks.ObjectID != null)) OR
((TestCases.Owner = "/user/184803097156") AND
(TestCases.ObjectID != null))) OR
(Owner = "/user/184803097156")))) OR
((TypeDefOid = 27397601061) AND
((((Tasks.Owner = "/user/184803097156") AND
(Tasks.ObjectID != null)) OR
((Defects.Owner = "/user/184803097156") AND
(Defects.ObjectID != null))) OR
(Owner = "/user/184803097156")))) AND
(((Iteration.Name = "I-12-2020") AND
(Iteration.StartDate = "2020-06-01T04:00:00.000Z")) AND
(Iteration.EndDate = "2020-06-15T03:59:59.000Z")))
Thanks for your help in advance.
Original Message:
Sent: 06-11-2020 11:41 AM
From: Nik Antonelli
Subject: How to locate the artifacts that the task owner of them is certain user, by one query?
Hi Nick,
Can you give us some hint on exactly how it doesn't work? What sort of error do you get? Have you looked at the error message returned by Rally in detail?
PS: Have you specified what artifact type you are trying to fetch in the query? I don't see that in the code snippet you pasted.
------------------------------
Nik
Ask me a question, I'm All Ears!
Rally Sales Engineer
Rally Software
Original Message:
Sent: 06-11-2020 09:52 AM
From: Nick Haifeng
Subject: How to locate the artifacts that the task owner of them is certain user, by one query?
Hi,
I want to locate some artifacts that their task owner is certain user. My current solution is to find all matched artifacts (regardless of the task owner) first. And then for each artifact, find tasks ref and use it to find all the tasks that linked to it. Then I can know if this artifact is the one I need or not.
However, this solution consumes time since there may be hundreds of queries. I find that in web request, the query "Tasks.Owner = "/user/xxxxxxxxxx"" is available. But I fail to apply it in my code. I'm not sure if there is something wrong. My code is listed below. Line "Query taskOwnerQuery = new Query("Tasks.Name", Query.Operator.Equals, userRef);" does not work as expected.
-------
string userRef = getRallyUserRef(userName);
Request attriRequest = new Request(attriType);
RallyRestApi restApi = rallyAuthenticate();
Query projQuery = new Query("Project.Name", Query.Operator.Equals, "CT-Mobile-MicroStrategyMobile");
Query iterStartQuery = new Query("iteration.StartDate", Query.Operator.GreaterThanOrEqualTo, iteration[0]);
Query iterEndQuery = new Query("iteration.EndDate", Query.Operator.LessThanOrEqualTo, iteration[1]);
Query ownerQuery = new Query("Owner", Query.Operator.Equals, userRef);
Query taskOwnerQuery = new Query("Tasks.Name", Query.Operator.Equals, userRef);
attriRequest.Query = projQuery.And(iterEndQuery.And(iterStartQuery)).And(ownerQuery.Or(taskOwnerQuery));
attriRequest.Fetch = new List<string>()
{
"Name",
"FormattedID",
"Owner",
"Tasks",
};
QueryResult attriList = restApi.Query(attriRequest);
List<string> attriID = new List<string>();