-3

How to Auto create a Review User Story (Review US: ….) for every new Feature created in TFS.

Kumar
  • 71
  • 8

1 Answers1

0

There isn't build-in feature to achieve this in TFS at present. The workaround is that you can do it trough programming:

  1. Build an application (e.g. web api) to create work items and add links programming (Parent-Child)
  2. Create a webhook for work item updated event, specify your app’s API URL

Some articles about create work items programming:

Create Work Item in Team Services Through API

TFS API Part 22 – Create Link Between Work Item (Parent, Child etc…)

Simple code to create work item and add links:

var u = new Uri("team project collection url");
            string projectName = "team project";
            VssCredentials c = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential("username", "password", "domain")));

            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(u, c);
            tpc.EnsureAuthenticated();
            WorkItemStore ws = tpc.GetService(typeof(WorkItemStore)) as WorkItemStore;
            var project = ws.Projects[projectName];
            var taskWit = project.WorkItemTypes["Task"];

            var requirementsTask = taskWit.NewWorkItem();
            requirementsTask.Title = "Requirement";
            requirementsTask.Save();

            var SWTask = taskWit.NewWorkItem();
            SWTask.Title = "SW";
            SWTask.Save();

            var versionWit = taskWit.NewWorkItem();
            versionWit.Title = "Version";
            versionWit.Links.Add(new RelatedLink(requirementsTask.Id));
            versionWit.Links.Add(new RelatedLink(SWTask.Id));
            versionWit.Save();

Hope this helps.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62