aggregator-cli
aggregator-cli copied to clipboard
Get Iteration Start and End Dates, based on Iteration ID
Feature Request
When the Work Item's iteration is changing, I need to update a custom field in the work item, with the new iteration's end date. That means, I need to be able to read the start date and end date from the Iteration (if it is set for that iteration). Is that possible now?
Currently this is not possible, if you're interested: I think I can provide you a code snippet for your rule code, which can support you in getting the information. It will be a workaround until a proper solution would be available.
Please. If you can provide a code snipped to get the start and end dates from the iteration using the iterationid, which is already available, I would be able to solve this issue. Thanks.
It is not nice in rule code, but it should do the work. btw. I did not test it.
You need
- a PAT
- URL
- teamproject name
- the node id, here 11111
var clientCredentials = new VssBasicCredential("PAT", "<token>");
var devops = new VssConnection(new Uri("https://..."), clientCredentials);
var client = devops.GetClient<WorkItemTrackingHttpClient>();
var nodes = await client.GetClassificationNodesAsync("<teamproject name>", new []{ 11111 });
var node = nodes.Single();
then you can access e.g. node.Name
or node.Path
var startDate = node.Attributes["startDate"] as string;
var finishDate = node.Attributes["finishDate"] as string;
the string will look like that:
"attributes": {
"startDate": "2017-03-22T00:00:00Z",
"finishDate": "2017-09-05T00:00:00Z"
},
Thanks. I'll try it out. BTW. Can I create inside the rule one or more common reusable methods to call multiple times inside the rule?
please see the advanced examples there is an example with a method which get called several times in the rule
It would be very nice to have these examples in the main documentation. After testing this, I might contribute to this extremely nice project and add it to the Examples documentation.
Thanks again.
Can I call multiple times, in the same rule, store.NewWorkItem?
Sure, this is supported