Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

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

$
0
0

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 AsNew NewSaveEvent


PrivateSub Project_Open(ByVal pj As Project)

  Set x.App = Application

End Sub

Class Module Code Snippet

PublicWithEvents App As MSProject.Application


PrivateSub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi AsBoolean, _
Cancel AsBoolean)

  Dim strSummary, StrError, strWBS, strCustomFieldName AsStringDim iLastLevel, iError AsIntegerDim taskField AsLong
'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
  
  
  
ForEach tsk In pj.Tasks
  
  If tsk.Summary = FalseThenIf (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
    EndIfIf (iLastLevel < 2 Or IsNull(iLastLevel)) Then
      iError = 1
      GoTo Err
    Else: strWBS = Left(tsk.WBS, Len(tsk.WBS) - iLastLevel)
    EndIfIf (IsNull(strWBS)) Then
        iError = 2
        GoTo Err
      ElseForEach tSearch In ActiveProject.Tasks
          If tSearch.WBS = strWBS Then
            strSummary = tSearch.Name
            ExitForEndIfNextEndIf
      
     
    
      
    tsk.SetField FieldID:=taskField, Value:=strSummary
  
EndIfNext
    
Err:

SelectCase iError

Case 1
StrError = "WBS Summary Postion could not be identified"Case 2
StrError = "WBS Summary String is Empty"EndSelectIf iError <> 0 Then MsgBox StrError
          
        
EndSub

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.


Viewing all articles
Browse latest Browse all 36188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>