Calculations Troubleshooting Guide

Version 21

    Verified Product Versions

    Service Desk 7.7.xService Desk 7.8.xService Desk 2016.xService Desk 2017.x


    This document goes through the troubleshooting process when a calculation is not working or is generating an error message.


    If your calculation is working but just not as you expect, then this is not the guide for you.  Refer to the tutorials for more information on the type of work your calculation is doing from the landing page here: LANDesk Service Desk Calculations Landing Page.  You can also start a discussion thread to ask others for advice.


    My calculation isn't working!

    Use the flowchart below to help troubleshoot your calculation.  Each question is detailed below the flow chart with more information on what to do in each step.


    Calculation Flowchart.png


    1. Does the "Test Syntax" button say the calculation is valid?


    Go to question 2.


    In the calculation editor, there is a button labelled Test Syntax.  This will test the basic syntax of the calculation and checks your list of Dependencies (when relevant).  If this check fails, you will not be allowed to save the calculation until the syntax checks OK.  For more information and explanations of common syntax error messages, please see this document: Errors when pressing "Test Syntax" or "OK" in the Calculation Editor.


    2. Are you using Service Desk version 7.6 and above?


    From Service Desk version 7.6 onwards there is a button in the calculation editor labelled Test Calculation.  Press this to test your calculation against an existing record.  If the calculation works the result is displayed.  If it fails then an error message is displayed along with which line of the calculation the error occurred on.  Run this and then go to question 4.


    Go to question 3.


    3. Is the calculation on a String attribute?


    You can add extra code to the calculation so that if an error occurs then the error message is used as the calculation's return value.  This allows you to see the error easily. However, this only works for String attributes.  See this document for more information: Trapping calculation errors and finding which line it occurred on.  Run this and then go to question 4.


    You can enable some logging so that if an error occurs in a calculation this is saved to a log file on your Service Desk server.


    Enabling Calculation logging on Service Desk 7.5 onwards
    1. Log in to Configuration Centre and find the Framework or Web Access application you want to enable the logging on.
    2. Select the Diagnostics action.
    3. Locate the Calculation category and set its logging level to All.
    4. Press OK to save the change.
    5. Logfile can then be found under C:\ProgramData\LANDesk\ServiceDesk\<application-name> on Windows Server 2008 and C:\Documents and Settings\All Users\Application Data\LANDesk\ServiceDesk\<application-name> on Windows Server 2003.


    Enabling Calculation logging on Service Desk 7.4 or earlier
    1. Connect to your Service Desk server.
    2. Locate the tps.config file for your Framework of Web Access application you want to enable the logging on.  This is found under C:\ProgramData\Touchpaper\<application-name> on Windows Server 2008 and C:\Documents and Settings\All Users\Application Data\Touchpaper\<application-name> on Windows Server 2003.
    3. Add the following line to the <appSettings> section: <add key="TraceLevel_Calculation" value="All" />.
    4. Save the file.


    Logging is now enabled, and you will find the log files on the server in the LogFiles sub-folder below your tps.config file.


    You may want to alter the trace level to only log failed calculations, in this case, the trace level value should be set to "Errors".  With the value at All every calculation the server performs is then logged and looks like:


    Attribute Calculation Successful at 2009-07-22 12:16:49.046
    Calculation successful for Attribute [_LengthofService] on Class Type [System.Analyst]
    On Object : Key = [aaac122d-6774-4458-adfb-6560641cc496]  Name = [Analyst 1]
    Calculated Value = [4]


    Calculation successful for Attribute [_LengthofService] on Class Type [System.Analyst] shows the calculation is on the _LengthofService attribute on the Analyst object which is under the System module.


    On Object : Key = [aaac122d-6774-4458-adfb-6560641cc496]  Name = [Analyst 1] shows the calculation is being performed on the analyst called 'Analyst 1'.


    Calculated Value = [4] shows us the result of the calculation is '4' and this is the value that will be displayed/stored.


    A failed calculation will look like:


    Attribute Calculation Unsuccessful at 2009-07-22 12:08:53.671
    Calculation successful for Attribute [_LengthofService] on Class Type [System.Analyst]
    On Object : Key = [2cba4bd5-c208-4733-a858-a35cf02ee30f]  Name = [SA]
    Calculated Value = []
    Object reference not set to an instance of an object.


    4. Is there an error message?


    If you have found the error message for your calculation, you can use this to find the cause of the problem.  Please see the following document for an explanation of common error messages: Troubleshooting calculation error messages


    If you do not have an error message, then the calculation is working!  If it looks like the calculation never even triggered then this probably means you do not have the correct Dependencies set, or you do not have the Is Calculate On Change? Property set to True in your window design on the Dependency fields.  Before Save and Window Calculation types are ONLY triggered when one of their Dependencies is set or changed so make sure that this is happening.  On complex calculations, you may need to disable the auto-detect option and set your Dependencies manually.


    If you are getting a result but it is not what you expected then refer to the calculation tutorials and Community discussions to check you have written it correctly.