Let the platform do the work

Health Check Error: Bad vardefs - multienum

Overview

The Health Check wizard must be run when upgrading to evaluate whether your instance is suitable for upgrade. During the health check, various types of issues may be detected which can affect your ability to upgrade. This article will cover how to resolve a "Bad vardefs - multienum" error (also shown as "badVardefsMultienum") reported by the health check.

Symptoms

This error generates an output similar to the following in health check:

Resolution

The generated error message will help determine the contents of the file causing the health check error.

In this example, the health check detects an issue with the special characters being used by a dropdown list named multiselect_test_list:

To address this error, the special characters identified in the health check error (e.g. &, -, /) will need to be removed from the dropdown definitions, and any existing records in your database storing those values will need to be updated as well. Follow the steps below to correct the necessary files:

Note : The following steps will guide you through making the necessary updates to ensure the health check passes. However, if you have other elements referencing the errant values (e.g. reports, workflows, web-to-lead forms, integrations, etc.), they may become non-functional once the corrections are made. We strongly recommend making these changes on a clone of your instance and testing thoroughly before executing the changes in your production environment.

  1. Backup all files located in the ./custom/include/language/ directory so errors in the below steps can be recovered if necessary.
  2. The only files that should contain these invalid definitions are located in the ./custom/include/language/ and/or ./custom/Extension/ directories of your instance. Identify all of the offending files with this dropdown definition by running the following command from both aforementioned directories: 
    find . -name "*.php" -exec grep -l "dropdown_list_name_from_health_check" "{}" \;
  3. Open each file returned from step 2 and locate the last definition of the offending dropdown list. Ensure that definition remains fully intact for now and delete any other definition for that dropdown list that exists in the file. Depending on when the dropdown list was created, there may only be a single definition in the file, but there are scenarios where there can be numerous entries for a dropdown list due to previous designs in dropdown editing in Sugar 5.x. A full dropdown list definition will have the following format:
    $GLOBALS['app_list_strings']['dropdown_list_name_from_health_check'] = array (
      '' => '',
      'item&event' => 'Item & Event',
      'item-test' => 'Item - Test',
      'item/widget' => 'Item / Widget',
    );
  4. Once all the files identified in step 2 are confirmed to only have a single dropdown definition within the file, copy the current definition to another file since you will need to reference the prior values when updating the database. 
  5. Dropdown lists consist of two components for each entry in the list: an item name and a display value. In the definitions depicted in step 3, the item name is the left side column of the array and these elements cannot contain special characters. Update the each item in the dropdown list to remove or replace any of the special characters mentioned in the original health check error message. Please ensure that the new item entry does not replicate the item name of another entry within the same dropdown list:
    $GLOBALS['app_list_strings']['dropdown_list_name_from_health_check'] = array (
      '' => '',
      'itemevent' => 'Item & Event',
      'itemtest' => 'Item - Test',
      'itemwidget' => 'Item / Widget',
    );
  6. Execute step 5 for each file containing the dropdown definition and ensure the item names are identical for each file.

By changing the item names, any existing data in the database that is using the old values will need to be updated with the new item names. The best method to achieve this will be running through the following queries:

  1. Identify all fields and their respective module using the affected dropdown list. Substitute the {dropdown_list_name_from_health_check} text with the dropdown list identified in the health check error message:
    SELECT name AS custom_field, custom_module FROM fields_meta_data WHERE ext1 = '{dropdown_list_name_from_health_check}';
  2. Update the field(s) in the respective table(s) with the following query. Utilize the results from the previous query to replace the {your_field} and {table_name} values, respectively. Use the old and new item names from the file-level edits to update the {old_item_name} and {new_item_name} values, respectively:
    UPDATE {table_name}_cstm SET {your_field} = REPLACE({your_field}, '{old_item_name}', '{new_item_name}') WHERE {your_field} LIKE '%{old_item_name}%';
    This query will need to be run for each of the item names that were changed in the affected dropdown list and for each field and module combination identified from the query in step 1. 

Once the necessary changes have been made, please navigate to Admin > Repair and perform a "Quick Repair and Rebuild" to ensure that the changes are synced between the application and database. Then, perform the health check again to confirm that the error is no longer reported.