Object Reference Error when evaluating Calculation

Version 2


    Service Desk 7.3 and newer.




    Using a Before Save calculation gives you the following error message:




    Object reference not set to an instance of an object.


    Stack Trace:

       at Touchpaper.Framework.Data.DataObjectCalculator.CalculateAttributeValue(IDataObject dataObject, String attributeName)

       at Touchpaper.Framework.Data.DataObjectCalculator.CalculateBeforeWriteAttributes(IDataObject dataObject)

       at Touchpaper.Framework.Data.DataObjectContext.PerformCalculations(IList listToUpdate, Boolean firstTime)

       at Touchpaper.Framework.Data.DataObjectContext.SaveChanges()

       at Touchpaper.Framework.Web.DataService.SaveChanges(SDataObjectContext sctxt, Boolean returnChanges)





    You have an attribute from a Collection Object set as the dependancy. You can't use an attribute on a collection as a dependency or you get issues like this when the calculation is trying to run even though it isn't relevant. You can use the collection itself as a dependency so that the calculation fires whenever a new collection item is created but not when a specific attribute on the collection is updated.