Monday, September 30, 2013

Issues update on #projectserver2013 - Timesheets and Publishing

Reporting Publish
** updated with links to other related discussions, and a VBA macro **

the following issue has been noted on publish since June 13 CU was applied:


ReportingProjectChangeMessageFailed (24006) - Object reference not set to an instance of an object.. Details: id='24006' name='ReportingProjectChangeMessageFailed' uid='4d869e56-f625-e311-bb41-005056b90052' QueueMessageBody='Project UID='e3f49977-b2bc-e211-8559-005056b90052'. PublishType='ProjectPublish'' Error='Object reference not set to an instance of an object.'.


I have seen this noted previously on a similar issue:

http://nearbaseline.com/blog/2013/06/ms-reporting-project-publish-jobs-failed-after-aprilcu/comment-page-1/#comment-14741

This is  caused by Baselined Milestones having NULL Baseline Cost values
Original bug note with potential workaround is here:


The following macro (from MS) is designed to resolve this:
NOTE:  I am providing NO warranty for this!


'DISCLAIMER OF WARRANTY
'
'THIS FIX CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
'MICROSOFT FURTHER DISCLAIMS ALL IMPLIED WARRANTIES INCLUDING WITHOUT
'LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS
'FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR
'PERFORMANCE OF THE CODE REMAINS WITH YOU.
'
'IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES
'WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
'BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
'OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
'THIS MACRO, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF
'SUCH DAMAGES. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR
'LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE
'ABOVE LIMITATION MAY NOT APPLY TO YOU.



'This macro attempts to work around the reporting publish failure that occurs when there are tasks

'with baselines and where the BaselineCost contour is NULL. The symptoms that you see in the queue
'for the "Reporting (Project Publish)" job has details similar to:
'
'
'
'uid="c72e20a7-9b7f-487b-9da2-19460b2e6c32"
'QueueMessageBody="Project UID='8e074f24-1064-47dd-bce5-c2dad8d556c8'.
'PublishType='ProjectPublish'" Error="Object reference not set to an instance of an object." />


'This code simply walks through the tasks in the tasks in the project and if there are

'baseline(s) set, then the code sets a time scaled baseline cost = 0 on the day prior to
'where the baseline start is scheduled.  This sets the baseline contour so that the
'"Object reference not set to an instance of an object" problem can be overcome during the
'reporting publish job.

Sub FixPublish()


Dim t As Tasks

Dim tsv As TimeScaleValues
Dim i As Long
Dim bCalc As Boolean

On Error Resume Next


'get the current application calculation state

bCalc = Application.Calculation
'set calculation to manual (helps with performance while the code runs)
Application.Calculation = pjManual

Set t = ActiveProject.Tasks


'walk through the tasks in the project. If a task as a baseline(s) then set a timescaled baselinecost = 0

For i = 1 To t.Count
    If Not t(i) Is Nothing Then
        If t(i).BaselineStart <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).BaselineStart - 1, t(i).BaselineStart - 1, pjTaskTimescaledBaselineCost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline1Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline1Start - 1, t(i).Baseline1Start - 1, pjTaskTimescaledBaseline1Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline2Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline2Start - 1, t(i).Baseline2Start - 1, pjTaskTimescaledBaseline2Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline3Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline3Start - 1, t(i).Baseline3Start - 1, pjTaskTimescaledBaseline3Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline4Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline4Start - 1, t(i).Baseline4Start - 1, pjTaskTimescaledBaseline4Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline5Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline5Start - 1, t(i).Baseline5Start - 1, pjTaskTimescaledBaseline5Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline6Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline6Start - 1, t(i).Baseline6Start - 1, pjTaskTimescaledBaseline6Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline7Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline7Start - 1, t(i).Baseline7Start - 1, pjTaskTimescaledBaseline7Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline8Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline8Start - 1, t(i).Baseline8Start - 1, pjTaskTimescaledBaseline8Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline9Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline9Start - 1, t(i).Baseline9Start - 1, pjTaskTimescaledBaseline9Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
        If t(i).Baseline10Start <> "NA" Then
            Set tsv = t(i).TimeScaleData(t(i).Baseline10Start - 1, t(i).Baseline10Start - 1, pjTaskTimescaledBaseline10Cost, pjTimescaleDays)
            If tsv(1).Value = "" Then
                tsv(1).Value = 0
            End If
        End If
    End If
Next

'fix the project summary task

With ActiveProject.ProjectSummaryTask
    If .BaselineStart <> "NA" Then
        Set tsv = .TimeScaleData(.BaselineStart - 1, .BaselineStart - 1, pjTaskTimescaledBaselineCost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline1Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline1Start - 1, .Baseline1Start - 1, pjTaskTimescaledBaseline1Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline2Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline2Start - 1, .Baseline2Start - 1, pjTaskTimescaledBaseline2Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline3Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline3Start - 1, .Baseline3Start - 1, pjTaskTimescaledBaseline3Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline4Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline4Start - 1, .Baseline4Start - 1, pjTaskTimescaledBaseline4Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline5Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline5Start - 1, .Baseline5Start - 1, pjTaskTimescaledBaseline5Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline6Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline6Start - 1, .Baseline6Start - 1, pjTaskTimescaledBaseline6Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline7Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline7Start - 1, .Baseline7Start - 1, pjTaskTimescaledBaseline7Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline8Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline8Start - 1, .Baseline8Start - 1, pjTaskTimescaledBaseline8Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline9Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline9Start - 1, .Baseline9Start - 1, pjTaskTimescaledBaseline9Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
    If .Baseline10Start <> "NA" Then
        Set tsv = .TimeScaleData(.Baseline10Start - 1, .Baseline10Start - 1, pjTaskTimescaledBaseline10Cost, pjTimescaleDays)
        If tsv(1).Value = "" Then
            tsv(1).Value = 0
        End If
    End If
End With
            
'set the application calculation state back the way it was
Application.Calculation = bCalc
            
End Sub