Thursday, December 22, 2011

How to enable or make editable Delete textbox in task with TFS 2008. How to Customize TFS 2008 work area?

Customizing the Work Item Tracking (WIT) Template

Changing work item templates, when new to team foundation server seems quite daunting - the first things I needed to learn about changing the work item templates were the witimport and witexport commands - these allow the import and export of XML definitions for work items on an existing project via the command line and editing the xml by hand was fiddly to say the least.

As said earlier TFS Power Tools makes this very simple by visually representing the XML for editing. The layout presented for editing the template look like a form layout which is quiet easy to work with.

Recently I had to modify the default Work Item templates for type Task to include a new custom field and also we needed to make the Task Start Date and Task Finish Date to be editable. The fields are editable in Database but are locked only in the UI. So we only have to make changes in the UI.

The reason these filed are read only is to prevent users modifying the dates. Often the tasks are loaded/imported from a MS Project Plan (.mpp) which has the Start Date and Finish Date along with dependencies and milestones. The effect of changing the date might change dates for other dependent task(s). MS Project can handle this, but when the date is modified in TFS Work Item and its synchronized with MS Project Plan the MPP is screw-up as this will not change the dependent tasks.

Now lets get the real action started, first I will show you how to make the Task Start Date and Task Finish date editable.

1. Making Task Start Date and Task Finish Date to be editable
1) Open Visual Studio (if not already open)
2) Open Team Explorer Window (Ctrl+\, Ctrl+M) (if not already open)
3) From VS Menu click "Tools" > "Process Editor" > "Work Item Types" > "Open WIT from Server" (Caution: You will be modifying this directly on the TFS Server so try to do it on Test Server rather than a production server)

4) Enter your server details and press "Connect"

5) You will now see all the projects in TFS, Select the Project and then expand it to select the work item type you want to edit Task for this post and click "OK"

6) You will see the screen similar to the one below, this is where you will be modifying the template. There are three tabs: Fields, Layout and Workflow. Fields Tab handles everything about the data/entity, Layout handles the rendering and view, Workflow defines how the data is transformed. You can also view the XML by clicking on View XML

7) As discussed earlier the fields Task Start Date and Task Finish Date are read-only in UI we will go to the Layout tab in order to make them editable.
8) Click tab "Layout"
9) Scroll down to locate "Control - Start Dat&e:", which is under "TabPage - Details" > "Group" > "Column" > "Group - Schedule"
10) Now in the properties for the control on right side of window select the property "ReadOnly" change the value to "False"
11) Repeat the step above to change property "ReadOnly" to "False" for "Control - &Finish Date:"

12) Now we need to change the type of control so that it will be rendered with standard date time control which we can use to select the date
13) On the properties pane of "Control - Start Dat&e:" select the property "Type" and change value from "FieldControl" to "DateTimeControl"
14) Repeat the step above to change the property "Type" for "Control - &Finish Date:" to "DateTimeControl"
15) Save the changes Ctrl+S or File > "Save __Task.wit"

16) After saving the changes refresh the project from Team Explorer, wait for some time after refresh and try to refresh couple of times and have some wait time between the refresh.
17) Open "Team Explorer" > Right click on the Project "SharePoint.Samples" > "Refresh"

18) To verify the changes now you should create a new task
19) Open "Team Explorer" > Expand the project "SharePoint.Samples" > Right click "Work Items" > "Add Work Item" > "Task"

20) Once the new task form is open, switch to "Details" tab and you should see your changes as per the image below

For More information please read SharemyPoint

No comments: