Calculating the next milestone

You can direct Infor Public Sector to calculate which milestone will follow another milestone using a next milestone formula. For example, you could write a formula for a Permit Issued milestone that advances to a Final milestone for residential projects and to a Pre-Final milestone for commercial projects.

Next milestone formulas use the oProjectApp object (an instance of the Hansen.CDR.Project.iProjectApplication class) to set NextState to a string value that is the exact name of the milestone that follows it. For more information about this object and for sample code, click the Information tab in the Formula Editor.

Examples

This formula advances the application to a Reviews milestone if the application is for a new construction or advances it to a Permit Issued milestone for any other work type.


If (oProjectApp.WorkType.Code.ToUpper = "NEW") Then
  NextState = "Reviews"
Else
  NextState = "Permit Issued"
End If

This formula advances an application to a Reviews milestone if the building area is less than 5000 square feet, and advances all other applications to a Prelim Reviews milestone.


If oProjectApp.BuildingArea <= 5000 Then
  NextState = "Reviews"
Else
  NextState = "Prelim Reviews"
End If

This formula advances an application to an Inactive milestone if there is no activity on the application for six or more months.


If System.DateTime.Now >= oProjectApp.LastActivityDateTime.AddMonths(6) Then
  NextState = "Inactive"
Else
  NextState = oProjectApp.ProcessState.DefaultNextState.Code
End If