How To
How to Fix "Error calculating formula for field 'field-name' on record 'record-id'"
if swimlane keeps throwing 500 errors when you click on records or when you try to open an application and you pull errors similar to the following from the database { 	" id" objectid(“\<object id>"), 	"date" isodate(“\<data>“), 	"hostname" “\<host name>", 	"layoutname" "fulldebug", 	"level" "error", 	"username" “\<user name>”, 	"methodname" "core engines calculation calculator performcalculationsforrecord", 	"linenumber" “\<line number>", 	"message" "error calculating formula for field \”\<field name>\” on record <“record id>, 	"applicatonid" “\<application id>“, 	"exceptionmessage" "object reference not set to an instance of an object ", 	"exceptionmethod" "system object calculate(core models record record, core models application application, system string)", 	"exceptiontype" "system nullreferenceexception", 	"exceptionstacktrace" "at core engines calculation calculator calculate(record record, application app, string formula) in /app/core/engines/calculation/calculator cs\ line \<line number>\n at core engines calculation calculator performcalculationsforrecord(record record, application app) in /app/core/engines/calculation/calculator cs\ line \<line number>“, 	"exceptionwithinner" "system nullreferenceexception object reference not set to an instance of an object \n at core engines calculation calculator calculate(record record, application app, string formula) in /app/core/engines/calculation/calculator cs\ line \<line number>\n at core engines calculation calculator performcalculationsforrecord(record record, application app) in /app/core/engines/calculation/calculator cs\ line \<line number>“ } you probably have calculated fields that are not doing the calculations correctly by taking into account empty fields let’s assume, for example, that you have a calculated field “case tt resolved min” whose calculations depend on “case created on” and “case closed on” fields "error calculating formula for field "case tt resolved min" on record \<record name>" is likely to happen if the field(s) “case created on” and/or “case closed on” are/is not populated accordingly chances are these fields are using a formula similar to the following if (\[case created on] = \[case resolved on], 0, totalminutes(\[case created on],\[case resolved on])) you will notice that the above formula is only checking if two fields are equal in order to skip the calculation and return 0 however, it is not checking whether “case created on” or “case resolved on” fields are empty this is likely causing the issue to confirm if this is the issue, open the problematic record(s) and check if all the fields are populated accordingly if they are not, you have found the problem! to fix this issue, do the following click on applications & applets on the left toolbar select the problematic application locate the fields in the form layout and select edit to open the calculation builder change the formula by adding a “or” and “isblank” in the below manner if you cannot see the image clearly, i have edited the formula in the below way in order to check if either field has no value if any of those conditions are true, it will skip the calculation and not error out if (or(\[case created on] = \[case closed on], isblank(\[case created on]), isblank(\[case closed on])), 0, totalminutes(\[case created on],\[case closed on]))