When trying to create a new category, getting the error 'The given key was not present in the dictionary'

Version 5

    Verified Product Versions

    LANDESK Service Desk 7.8.x

    PROBLEM

     

    When trying to create a new category, getting the error 'The given key was not present in the dictionary'.


    This error can occur when parent categories have been deleted in the database, and the children still exist, and when you try to create a new category, you will get this error.

     

    Categories should only be soft deleted from the database, so that they can still be seen on old records, hard deleting them in the database can make the categories unusable, ideally modification of the categories should only be done via the application.

     

    SOLUTION

     

    The following sql statement will remove the children categories that are casuing the error.


    Firstly, you need to check what category object it is in Administration within Console you are trying to create the category for, i.e. category, note category, task category etc

     

    Then apply the follwoing SQL, it will need to be modified according to the category object that is giving the error.

     

    update im_incident_note_cat set im_deleted = 1 where im_parent_guid in (select im_guid from im_incident_note_cat where im_deleted = 1) and im_deleted = 0

    This example will fix the problem under the 'note category' object, if you get the error for any other object you will need to amend the above statement in the 2 places where it states im_incident_note_cat.

     

    im_incident_note_cat is the name of the table in the database that relates to the category note object, if you get the error for a different category object you can find out the other table names in the database that relate to the object.

     

    Please be sure to take a full restorable backup of your database before applying the above fix.

     

     

    -----

     

    If you are getting this error message when trying to export a Category List, please see here.