Microsoft Project Support Blog

The place to come for Microsoft Project, Microsoft Project Server and Project Online support topics

Project Server 2010: Unable to Add Summary Task to Resource Assignments View

Project Server 2010: Unable to Add Summary Task to Resource Assignments View

  • Comments 2
  • Likes

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.

  1. Take a copy of your production database and create a new test PWA site to test the functionality before deploying into production.
  2. 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.
  3. Open Project Professional, click the View tab, Click the down arrow under Macros and then select Macro Security on the drop menu.
  4. Select Disable all macros with notification, click the OK button and then close Project Professional.
  5. In PWA, open the Enterprise Global in Server Settings->Enterprise Global and click the Configure Project Professional button.
  6. In Project Professional, click the View tab, Click the down arrow under Macros and then select Visual Basic on the drop menu.
  7. In the Project Explorer, in the top left corner by default, double click ThisProject under VBAProject(Checked Out Enterprise Global)->Microsoft Project Objects.
  8. Copy the code from the ThisProject Code Segment below into the ThisProject Window.
  9. On the Menu Bar click Insert and then Class Module.
  10. 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.
  11. In the Properties Windows, select the (Name) field and enter in “NewSaveEvent”
  12. Copy the code from the Class Module Code Segment below into the NewSaveEvent Window.
  13. 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.
  14. Save and Check In the Enterprise Global and close Microsoft Project Professional.
  15. In PWA go to Server Settings->Manage Views, select Summary under Resource Assignments.
  16. 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.
  17. Open Project Professional, open a test file, add the Custom Field that you created in step 2 into the current view and press F9.
  18. 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.

  19. Save and Publish the project.
  20. Verify that the Custom Field was populated in Project.
  21. Go to the Resource Assignments view and verify that the Summary Tasks now shows in the new Custom Field in the view.     



ThisProject Code Snippet

Dim x As New NewSaveEvent


Private Sub Project_Open(ByVal pj As Project)

  Set x.App = Application

End Sub

Class Module Code Snippet

Public 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 = ActiveProject
  
  
  
  For 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 If
  
      
     
    
      
    tsk.SetField FieldID:=taskField, Value:=strSummary
  
    
  End 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.

Comments
  • I was wondering why i couldnt get a summary task. This sure seems like basic functionality that should not require custom code. Why wouldn't this be fixed in a SP or Hotfix?

  • Hi Newbie, this is certainly something we would have liked to fix - but with any software product there are always trade-offs and the complexity of this particular issue (in terms of fixing, testing etc.) when there is a possible workaround with the code above meant we decided that other issues should have priority.

    Best regards,

    Brian.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment