Error message: 'An item with the same key has already been added' when logging in to Service Desk with any user

Version 7

    Verified Product Versions

    Service Desk 7.7.xService Desk 7.8.xService Desk 2016.xAsset Manager 2016.x



    Noone can log in to Service Desk after the MDM has been run.

    Error message "An item with the same key has already been added." is displayed .


    login error.JPG





    One of the causes for this error could be because there is a Web Desk window manually created for the "Query Template" Object.


    There is a hard coded default WebAccess window for the "Query Template" Object. This is the window you see when you want to set the default Query for an Object in Web Desk.
    This was developed to not show in Console as it would never be used other than in Web Desk, so if you go in to Window Manager - Metadata - Query Template, this will in an OOTB not have any windows. However in the back end it does have a default WebAccess window.


    When the Metadata is run, it will check this default WebAccess window and make sure that the "Query Template" window for WebAccess is set to be the default window. If it's not, it will set it to be the default one for this Object.


    If you manually create a window on the "Query Template" Object and then published it to WebAccess this window will automatically become the default window for WebAccess. When this happens the OOTB hard coded default WebAccess window for Query Template will be set to not be default.


    If you then run the MDM, the MDM will set the original window back to be default, meaning that you will now have two default windows for WebAccess on the Query Template Object. This is why you are getting the error message when you are trying to log in to Console.



    To fix:


    If you have a backup of your database since before running the MDM, the easiest solution is to restore to this backup, log in to Console and delete the Query Template window for WebAcces and then run the MDM again.


    If you do not have a backup, you can set the window that was manually created for WebAcces on the Query Template Object to not be default by running the below script:




    Update ui_form set ui_is_default = '0'
    where ui_class_type_guid = (select md_guid from md_class_type where md_name = 'QueryTemplate')
    and ui_layout_type = '2' and ui_name != 'default'
    After you have run this script, do an IISReset and log back in to Console. Go to Window Manager - Metadata - Query Template. Highlight the created window and select "Delete Web Access Window" from the Actions Panel.
    This has been given problem reference: 5421. If you are experiencing this issue, please log a Support Case with your Support Provider referring to problem 5421.