GoldMine Web (GMWEB) - Run command or read fields error - in the Logfile additionally: An item with the same key has already been added

Version 1

    Details

     

    GoldMine Web (GMWEB)  Run command or read fields error. ,An item with the same key has already been added.


    [STEPS TO REPRODUCE]

    1. Log into GoldMine Web 

    2. The User may receive a Server Error - Run command or read fields error





    NB: Also a Server Error: An error has occurred on the server. Please contact your system administrator. can be experienced (please make sure also to review Knowledge Article #15452 :  GoldMine Web (GMWEB) - An error has occurred on the server.  Please contact your system administrator. - when logging into GoldMine  Web and opening contact list in CONTACTS



    On the GoldMine Web Server the GMConnect.Log file (this can be found in the GoldMine Connect installation folder \Logs) the following entries are identified


    2015-01-22 13:50:16,526 - [ERROR] Thread id[9] - GoldMine.Models.ApplicationExceptions.ClientInformationException: Run command or read fields error.,
    System.ArgumentException: An item with the same key has already been added.
       at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at QueryBuilder.UserDefFieldsContainer.ReadFields()
    2015-01-22 13:50:23,634 - [ERROR] Thread id[9] - GoldMine.Models.ApplicationExceptions.ClientInformationException: Run command or read fields error.,
    System.ArgumentException: An item with the same key has already been added.
       at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at QueryBuilder.UserDefFieldsContainer.ReadFields()
    2015-01-22 13:50:23,634 - [ERROR] Thread id[9] - GoldMine.Models.ApplicationExceptions.ClientInformationException: Run command or read fields error.,
    GoldMine.Models.ApplicationExceptions.ClientInformationException: Run command or read fields error.
       at GoldMine.Models.Log.GMLoggerFactory.GMLogger.ErrorClientAndServer(Object customMessage, Exception e)
       at QueryBuilder.UserDefFieldsContainer.ReadFields()
       at QueryBuilder.DependencyUserDefFieldsContainer.AddSubscriber(String DataConnectionString, String Model, String PropertyName, String DataSQL)
       at QueryBuilder.UserDefFieldsHolder.AddContainerToDictionary(String dependency_connection_string, String Model, String PropertyName, String sSQLDependence, String data_connection_string, String sSQLData)
       at QueryBuilder.UserDefFieldsHolder.AddUserDefFields(String Model, String PropertyName, String sSQLDependency, String sSQLData)
       at QueryBuilder.MetaInfo.AddContactModel(Meta meta, Boolean isMainContactModel)
       at QueryBuilder.MetaInfo._Init()
       at QueryBuilder.MetaInfo.Init()
       at QueryBuilder.MetaInfo.GetMetaInfo()
       at STranslator.FieldListHelper.IsDbFieldNotNull(Type ModelType, String FieldName)
       at STranslator.FieldListHelper.GetFieldOrSqlIsNull(Type model, String Field)
       at STranslator.FieldListHelper.GetStartConditionElem(Type model, IEnumerable`1 StartValues, IEnumerable`1 StartValueFields, String StartValueOp)
       at STranslator.FieldListHelper.GetStartValuePart(Type model, IEnumerable`1 StartValues, IEnumerable`1 StartValueFields, String StartValueOp)
       at STranslator.FieldListHelper.SearchCondition(Type model, IEnumerable`1 SearchFields, String SearchBeginsWithValue, IEnumerable`1 StartValues, IEnumerable`1 StartValueFields, String StartValueOp)
       at GoldMineMobile.Controllers.Protocol.FieldsRequestParameterEx.GetSearchCondition(Type model)


     


    Resolution

    [CAUSE]
    - An identified reason but not  the exclusively root cause, is that the CONTUDEF table for the currently used  contact set database contains duplicate entries for a Field_Name (the  name for a field in the Microsoft SQL Server back end).
    - This might be related to a CONTACT1 and/or a CONTACT2 field, so the whole table needs to be verified.
    - The following SQL query can be run to determine if the CONTUDEF  contains any duplicate rows.

    SELECT  COUNT(*), FIELD_NAME, DBFNAME FROM CONTUDEF GROUP BY FIELD_NAME, DBFNAME ORDER BY COUNT(*) DESC
     



    IMPORTANT INFORMATION:
    - The following steps should only be performed by an experienced GoldMine and SQL Administrator as deleting  wrong data in the back end will result in data loss and malfunction of  GoldMine!
    - The FIELD_NAME ACCOUNTNO is 2 times available in  the CONTUDEF table one time with a DBFNAME CONTACT1 and one time with a  DBFNAME CONTACT2 - This is NO DUPLICATE 

    [RESOLUTION]
    -  Although it is technically not absolutely necessary, it is highly  recommended that all users are logged out of GoldMine, GoldMine Web and GoldMine Mobile, also all  users should close any applications integrating with GoldMine, and  services accessing the GoldMine application should be stopped by an  Administrator

    1. Make sure to have a full running backup of the GoldMine database you will change
    2. In SQL Server Management Studio > browse to and expand the GoldMine/Contact Set database
    3.  Expand Tables and right click on CONTUDEF > Edit Top 200 Rows  (if there are more than 200 records in this table this needs to be  adjusted by increasing the Top 200 value via the show SQL Pane button)
    4.  Verify and delete duplicate rows (make sure that both entries are  identical and if not verify which entry is the proper one used within  GoldMine)
    5. It is recommended to restart the IIS
    6. Start GoldMine Web again and verify the behavior again





    Additional information:
    - It is highly recommended to document the change in the back end
    -  Keep in mind that this change is not sync aware, which means, if you  recognized duplicates in the CONTUDEF table this should be checked also  on any remote GoldMine systems
    - When any fields with a DBFNAME  CONTACT2 were deleted it is strongly recommended to perform a maintain  individual tables (CONTUDEF + CONTACT2) with rebuild and pack the  database tables from within GoldMine (Tools > Databases >  Maintain Database feature).  For the deletion of the back end, it is  strongly recommended that all users are logged out, all applications  integrating with GoldMine are closed and all services accessing the  GoldMine database or application, this is absolutely necessary when  performing a rebuild and pack action. After the rebuild action the user  defined fields where a duplicate was deleted from CONTUDEF need to be  verified. Also in this case it is necessary to restart the IIS again  before users log again into GoldMine Web or GoldMine Mobile.