We have had several customers report that they no longer have the ability to add the Summary Task field to the Resource Assignments View in 2010 like they could in 2007. Unfortunately, this is a byproduct of switching the view from Active X to Ajax. Unfortunately, this feature did not make it into the new view. We are able to workaround this, however, by using a macro to automate the population of a Custom Field which can be added to the view.
This workaround create an Application ProjectBeforeSave Event that will populate a Task level Text Custom Field every time the use saves the project. You can then add the Custom Field to a Resource Assignment view to show the Summary Task. It does require that you enable VBA in Microsoft Project to have this work so you should evaluate your organizational security requirements before deciding to deploy this into production. If there are concerns, you can mitigate this by signing the VBA Project.
Below is a code sample of how you might implement this as well as directions for setting it.
Warning: This is sample code that is provided “as-is” and there is no warranty provided or implied. Please note that this has not been tested in your environment with your data. As such, it is possible that it could incorrectly change data so you will need to thoroughly test this before placing this code into production.
Note: This should cover scenarios where the last WBS level is 999 or less.
- Take a copy of your production database and create a new test PWA site to test the functionality before deploying into production.
- Create a new Task Text Custom Field on the server and make sure to set the Calculations for Assignment Rows to Roll down, unless manually specified.
- Open Project Professional, click the View tab, Click the down arrow under Macros and then select Macro Security on the drop menu.
- Select Disable all macros with notification, click the OK button and then close Project Professional.
- In PWA, open the Enterprise Global in Server Settings->Enterprise Global and click the Configure Project Professional button.
- In Project Professional, click the View tab, Click the down arrow under Macros and then select Visual Basic on the drop menu.
- In the Project Explorer, in the top left corner by default, double click ThisProject under VBAProject(Checked Out Enterprise Global)->Microsoft Project Objects.
- Copy the code from the ThisProject Code Segment below into the ThisProject Window.
- On the Menu Bar click Insert and then Class Module.
- In the Project Explorer, in the top left corner by default, double click Class1 under VBAProject(Checked Out Enterprise Global)->Microsoft Project Objects->Class Modules.
- In the Properties Windows, select the (Name) field and enter in “NewSaveEvent”
- Copy the code from the Class Module Code Segment below into the NewSaveEvent Window.
- In the NewSaveEvent Window find the line below and change the value of the strCustomFieldName variable to the name of the Custom Field you create in step 2.
- Save and Check In the Enterprise Global and close Microsoft Project Professional.
- In PWA go to Server Settings->Manage Views, select Summary under Resource Assignments.
- Add the Custom Field that you created in step 2 to the view, move it next to the Name field and click the Save button.
- Open Project Professional, open a test file, add the Custom Field that you created in step 2 into the current view and press F9.
- Save and Publish the project.
- Verify that the Custom Field was populated in Project.
- Go to the Resource Assignments view and verify that the Summary Tasks now shows in the new Custom Field in the view.
Note: The Custom Field does not have to be visible for this is to work, we are just doing this so verify that the fields are populated in Project.
ThisProject Code SnippetDim x As New NewSaveEvent Private Sub Project_Open(ByVal pj As Project) Set x.App = Application End Sub
Class Module Code SnippetPublic WithEvents App As MSProject.Application Private Sub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi As Boolean, _ Cancel As Boolean) Dim strSummary, StrError, strWBS, strCustomFieldName As String Dim iLastLevel, iError As Integer Dim taskField As Long'Change this value to the name of the Custom Field you created to store 'the Summary Task Name strCustomFieldName = "Set Custom Field Name Here"taskField = FieldNameToFieldConstant(strCustomFieldName, pjTask) iError = 0 Set pj = ActiveProjectFor Each tsk In pj.Tasks If tsk.Summary = False Then If (Mid(tsk.WBS, Len(tsk.WBS) - 1, 1) = ".") Then iLastLevel = 2 ElseIf (Mid(tsk.WBS, Len(tsk.WBS) - 2, 1) = ".") Then iLastLevel = 3 ElseIf (Mid(tsk.WBS, Len(tsk.WBS) - 3, 1) = ".") Then iLastLevel = 4 Else: iLastLevel = -1 End If If (iLastLevel < 2 Or IsNull(iLastLevel)) Then iError = 1 GoTo Err Else: strWBS = Left(tsk.WBS, Len(tsk.WBS) - iLastLevel) End If If (IsNull(strWBS)) Then iError = 2 GoTo Err Else For Each tSearch In ActiveProject.Tasks If tSearch.WBS = strWBS Then strSummary = tSearch.Name Exit For End If Next End Iftsk.SetField FieldID:=taskField, Value:=strSummaryEnd If Next Err: Select Case iError Case 1 StrError = "WBS Summary Postion could not be identified" Case 2 StrError = "WBS Summary String is Empty" End Select If iError <> 0 Then MsgBox StrError End Sub
This code sample will show the immediate Summary Task but you can modify it to include more levels if you require. Keep in mind that larger values in that Custom Field could impact how many other fields you can easily fit into the view.
Good luck, and always remember to test before you deploy a significant change into production.