Is there a way to setup custom triggers in Visual Studio Team Services/TFS? - tfs

I use VSTS/TFS for work and side projects and I wanted to setup a trigger/rule that would automatically move stories into a certain iteration when I move them from "New" to "Approved" or whatever column is associated with an active state. I know how to change the iteration manually but it would be way easier if there was a way to say something like this psuedocode:
if (workItem.State == "Active") {MoveToIterationActiveForTodaysDate();}
Ideally too, if this isn't too picky, I would like it to only run on initial move so I can reassign to a different iteration later if I wanted to.
If anyone has an easier way to do this too that accomplishes the same thing (moving items to an iteration without having to manually activate the story and move it to the desired iteration) that would work as well. I'm still figuring out the ideal way to manage VSTS/TFS. Thanks in advance

Using VSTS is able to customizable work item rules.
Whether it be automatically setting the value of certain work item
fields or defining the behavior of those fields in specific states,
project admins can now use rules to automate the behavior of work item
fields and ease the burden on their teams.
More details please refer this tutorial: Add a rule to a work item type
However, it works with fields in the work item, not able to move work item to different iteration or area directly.
There is no out of box feature could achieve your requirement with TFS and VSTS for now. You may have to customize TFS events/actions to achieve the same feature as right click the work item--select move iteration--choose iteration.
Moreover, you could also use some 3-rd party extensions/tools such as Giulio
suggested TFS Aggregator.

As of today, there is no built-in automation, so the community wrote some tools that react at TFS/VSTS events and run scripts.
I can suggest TFS Aggregator which is used by many organization throughout the world: I am one of the core contributor.

Related

TFS 2015-2017 Assistance

I am new to TFS and know the basic concepts. In my case we have customized TFS a lot which contains around 17 collections, custom fields in work items etc.
I have some queries for which I require some answers. The questions might be generic, but any help or suggestions on the below queries would be great.
Following are my queries:
1.) Show Work Item ID in a specific format. Can it be done
2.) Auto Fill custom fields for a work item based on a category / linked bugs (analogous to Relative Path column type)
3.) While raising a WI through Visual Studio development tool, the datepicker only takes date value and not time. The same work items when raised through web portal the datepicker gives time value as well.
4.) Auto Fill the efforts spent in Child Work items (summation of all child link items in the parent)
5.) Reminders to be sent if iteration / scrum set date crossed. Also check for Work Items as well, if set date is crossed.
6.) Create Queries which can query across all collections / verticals. Currently queries can be made only against each entire collection, but not across all collections. Do we have any mechanism to query against multiple collections?
7.) Email alerts customizations in TFS.
8.) Can the collections be merged into 1 default collection.
I have tried to find few answers from my end as well, and would like to know, if it is correct.
1.) Work Item ID cannot be shown in a specific format as it is system generated
2.) For Auto Filling of Work Item fields, it cannot be done. Manual approach is the only way (unless there is a way to pre-populate fields
3.) One can only query for all projects in a single collection. But it is not possible to query against multiple collections and get the results.
So require assistance on the above queries and also validate the answers I have got for few of my questions.
Any help or suggestions or relevant links would be great.
Thanks In Advance!!!..
Please kindly check below inputs
You are right. This is by designed. You can not change to use other
format of work item.
Yes. This could not be done at present. It's still a user voice, but
on the Roadmap. Support for calculated fields and roll-ups.
Sorry, not get your point.You could use the DateTimeControl type to give users a calendar picker to select a date for a DateTime field. By using this control, you can quickly select a date and time for the field. For details.
You could do this from a sprint backlog or task board. Details
please take a look at our official tutorial here: Rollup of work
and other fields
We do not have this kind of build-in time reminder for work items.
However, as a workaround, There is a dashboard widget that uses #me
in its query.
You can also cobble something together using the REST API and a
scheduled build. Calling a work item query and sending email is
pretty easy from PowerShell.
No, they are using different database. You are only able to query
across team projects int the same project collection.
It's able to do this but with a little bit complicated. For detail
info, please take a look at this link: Customize TFS 2015 alert
email
There is no default way to do this. I do not think there is a
possibility of merging two TFS collections other than creating a new
collection, creating the team projects and use a tool such as TFS
integration tools to move the team projects from the source
collections.
As you can see, history will be rewritten with new dates, changeset
and work items ids etc, if you are trying to merge collections.

TFS Work Items: Workaround for dashboard widgets unable to show tree of work item type queries

We have a work item structure in TFS 2015 (Will soon be upgraded to 2017, in case there are features there which may be relevant) which consists of the usual CMMI template hierarchy: Epic->Feature->Requirement (Where requirement is roughly analogous to PBI in other templates, for those unfamiliar)
We have abstracted the large body of work by making Epic and Feature meaningful. Applying a common analogy, an Epic->Feature->Requirement in this setup for a requirement on a webpage might be [Security]->[Password Management]->[Password Complexity rule xyz]
The main problem is that, while the 'tree of work items' type query is powerful and useful for this setup, some features of TFS only work on flat list of work item type queries, including dashboard widgets. Continuing the example above, if I wanted to create a widget to see how many Security Requirements (PBIs) were completed, I could not do that.
I'm looking for ideas on how to get around this restriction in VS2015 or VS2017, and the best solution I can think of so far is to create a service hook which uses the TFS api to traverse the tree and then copy the title or ID of the parent Epic/Feature onto the Requirement in some dummy field. This seems very clunky and inelegant. Another option would be to mirror the Epic/Feature hierarchy in Areas, but this is quite unfavorable as we use the Area for another purpose and it creates a maintenance problem as they would need to be kept in sync.
There is Query Results and Chart for Work Items widgets that can uses Tree of work items in TFS 2015, but can’t just count the children work items (e.g. Requirements)
You can build a custom widget extension and retrieve the corresponding work items through REST API and count related work items.
There is a sample with detail code of how to retrieve the data through REST API, so you can refer to this article to build a custom widget extension: Add a dashboard widget

How to automatically assign a TFS work item to a particular person/role

I would like to customize a Work Item Type in TFS to automatically set the Assignee to a particular role. For example (to compare to another Issue Tracker), in JIRA the default Assignee is the Project Lead (so that any ticket not otherwise assigned, gets automatically assigned to whatever person is designated in the role of Project Lead). Can I do something similar in TFS?
So, I realize that one difference between JIRA and TFS is that TFS doesn't (to my knowledge) have the concept of "Roles". The closest thing to that is "Groups", but unlike Roles, Groups can have multiple people (which may be the restricting factor in this problem). I know how to configure a TFS Work Item so that only a certain Group gets listed in the "Assign To" field, but I would like to go a step farther, if possible, and create a custom Group with just one member (e.g., "Issue Guru") and then set up the work item to get automatically assigned to that person.
I'm trying to replicate the Jira functionality here, and maybe there is just no good way to do it in the TFS framework. Any suggestions?
There's a Step by Step Guide on Ivan Fioravanti's Blog for enabling it.
If you are unfamiliar with customising Work Item Types, have a look at the following links (stolen from Grant Holliday's blog).
I never tried this in production but here is something I tried quickly and it seems like it could work.
You can set the default value to a Group by editing work item template in template editor.
Just select Assigned to field and add a DEFAULT rule like shown in the image below.
This will also require you to create one or more groups (one global or maybe one per project). Once you set this up you won’t have to make any updates in the future but only manage people who are in the groups.

TFS task with more assignees

What is the best way to store a task for multiple users in TFS 2010 ? I can only assign one for one task.
(for example: when I plan a demo to all developers)
(this is a scrum Msf Agile project, where the task is part of a user story)
I'm sorry to tell you that you can't assign multiple users to a single work item out of the box; At the same time, I do not recommended trying as this, as it does not fit the model in TFS. The conventional / recommended way to handle this type of scenario is to create multiple tasks; one for each developer in this case. You can easily accomplish this by copying a set of tasks using MS Excel. Another option (given the example you used) is to create a "Meeting" work item that has multiple drop-downs - one for each person that would attend meetings like for a demo or a technical review.
Yet another option is to create a custom control to format and store a list of users. This would likely be relatively complex to maintain, as you have to distribute it to each user's machine (it will need to be installed locally), and last I checked you would need 2 versions; one for the Team Explorer user interface and another for the Web Access tool that most people use to create work items from a web page on their TFS server. Future updates to TFS could possibly break your custom control. It is rarely worth the effort. Another downside is the you would likely be limited by how you can use MS Excel to work with the data you store in the field that the custom control works with. If you want to look into this further you can find some examples in the following CodePlex project: http://witcustomcontrols.codeplex.com/
You might consider your true goals in tracking such things as meetings and other items you want to assign multiple people to. Tasks are the heart of tracking progress of user stories in the MSF Agile Template. Tracking meeting attendance does not typically relate directly to a User Story, for example; so it won't typically assist you to determine how much close you are to being "done" with a User Story. If you want to take advantage of the existing reports, then you should organize your tasks so that they roll up as child work items to User Story (or Bug) work items.
Short story: you can't. Work items in the Process Template of Microsoft are designed to target nobody or only one User.
Now you can customize the Process Template to change this.
Take this post for instance, the customization works for group. But I don't recommend you to do so because TFS is basically not designed for that and you may end up disappointed.

How to change ID?

Hallo experts,
i'm newbie to TFS, but responsible for SW Test in my group. I'm trying to create a couple of test cases thru MS Visual Studio. I don't know how to change the Test Case IDs, which seem to be automatically assigned by the system. However we want to adapt the IDs to the conventions in our SW specifications. Thanks in advance.
JohnMunich
If what you're looking for is a custom Test Case ID, you'll probably want to modify your work item template for the test cases with a new, custom field.
You can do this by exporting the appropriate work item type using the TFS Power Tools, adding the field and re-importing.
If you want the field to show up in the warehouse, be sure to make it reportable.
Note: The direct link is for the TFS 2010 power tools. This page also contains a link to the TFS 2008 Power Tools.
I don't believe there's any way to do this within TFS itself. These numbers are assigned and internally they are used as primary keys for the data.
You potentially could change the number that will be assigned. I think this might be of help.
The problem is that this will change the next User Story ID that you generate, too.

Resources