"Object reference not set to an instance..." error when trying to modify a query

Version 3

    Verified Product Versions

    LANDESK Service Desk 7.6

    Problem

     

    On trying to modify an existing query you recieve the error "Object reference not set to an instance of an object".  Clicking on the Details button shows the stack trace of either:

     

    System.NullReferenceException: Object reference not set to an instance of an object.
       at Touchpaper.Console.UI.Windows.QueryAuditUserControl.ReloadUpdatedBy()
       at Touchpaper.Console.UI.Windows.QueryAuditUserControl.SetController(ConsoleQueryBuilderController controller)
       at Touchpaper.Console.UI.Windows.QueryPropertiesPage.SetupControl()

       ....

     

    or

     

    System.NullReferenceException: Object reference not set to an instance of an object.
       at Touchpaper.Console.UI.Windows.QueryAuditUserControl.ReloadCreatedBy()
       at Touchpaper.Console.UI.Windows.QueryAuditUserControl.SetController(ConsoleQueryBuilderController controller)
       at Touchpaper.Console.UI.Windows.QueryPropertiesPage.SetupControl()

       ...

     

    Solution

     

    This will occur when either the user that created or last updated the query has been deleted.  This has been logged as Problem 4706 due to be fixed in a future release.  For now you can change the creator/updater of the query to an active user via the following SQL statements that will fix any effected query:

     

    Please note to always take a fully restorable backup of your database and to always run on a test system before actioning any script on your live system

     

    ----------------------------

    update md_query_template set md_creation_user_guid = (select tps_guid from tps_user where tps_name = 'SA')

    where md_creation_user_guid in (select tps_guid from tps_user where tps_deleted = 1);

     

    update md_query_template set md_last_update_user_guid = (select tps_guid from tps_user where tps_name = 'SA')

    where md_last_update_user_guid in (select tps_guid from tps_user where tps_deleted = 1);

    ----------------------------

     

    If you experience this issue please also log an incident with your support provider quoting problem 4706 so your instance of the issue can be added to the problem record.