Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Iteration Start and End Dates, based on Iteration ID #120

Open
mmuresan opened this issue Apr 16, 2020 · 8 comments
Open

Get Iteration Start and End Dates, based on Iteration ID #120

mmuresan opened this issue Apr 16, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@mmuresan
Copy link
Contributor

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?

@mmuresan mmuresan added the enhancement New feature or request label Apr 16, 2020
@BobSilent
Copy link
Collaborator

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.

@mmuresan
Copy link
Contributor Author

mmuresan commented Apr 19, 2020 via email

@BobSilent
Copy link
Collaborator

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"
},

@mmuresan
Copy link
Contributor Author

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?

@BobSilent
Copy link
Collaborator

please see the advanced examples there is an example with a method which get called several times in the rule

@mmuresan
Copy link
Contributor Author

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.

@mmuresan
Copy link
Contributor Author

Can I call multiple times, in the same rule, store.NewWorkItem?

@BobSilent
Copy link
Collaborator

Sure, this is supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants