Health Check Error: Bad vardefs – key

    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 the “Bad vardefs – key” error reported by the health check.

    Symptoms

    badVardefKey

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

    Resolution

    In this example, the vardef identified in the health check error is for a custom relationship between Accounts and Cases. This relationship and the code causing the issue, is defined in the ./custom/Extension/modules/Accounts/Ext/Vardefs/accounts_cases_1_Accounts.php file.

    In this file, the array that is triggering the error is contained in:

    $dictionary["Account"]["fields"]["accounts_cases_1_name"] = array (
      'name' => 'accounts_cases_1_name',
      'type' => 'relate',
      'source' => 'non-db',
      'vname' => 'LBL_ACCOUNTS_CASES_1_FROM_CASES_TITLE',
      'save' => true,
      'id_name' => 'accounts_cases_1cases_idb',
      'link' => 'accounts_cases_1_edit',
      'table' => 'cases',
      'module' => 'Cases',
      'rname' => 'name',
    );

    The ‘link’ object in the array is causing the error because it has been edited and no longer matches the vardef name. The correct name of the relationship is accounts_cases_1, so the link should refer to that relationship:

    'link' => 'accounts_cases_1',

    Since the link in this example references the incorrect relationship, the field this vardef controls will not function as intended. 

    The upgrade will automatically correct this issue so that the link value corresponds to the appropriate relationship name. The corrected file should look similar to this:

    $dictionary['Case']['fields']['accounts_cases_1']['name'] = 'accounts_cases_1';
    $dictionary['Case']['fields']['accounts_cases_1']['type'] = 'link';
    $dictionary['Case']['fields']['accounts_cases_1']['relationship'] = 'accounts_cases_1';
    $dictionary['Case']['fields']['accounts_cases_1']['source'] = 'non-db';
    $dictionary['Case']['fields']['accounts_cases_1']['module'] = 'Accounts';
    $dictionary['Case']['fields']['accounts_cases_1']['bean_name'] = 'Account';
    $dictionary['Case']['fields']['accounts_cases_1']['vname'] = 'LBL_ACCOUNTS_CASES_1_FROM_ACCOUNTS_TITLE';
    $dictionary['Case']['fields']['accounts_cases_1']['id_name'] = 'accounts_cases_1accounts_ida';
    PatrickM
    in Troubleshooting Health Check Output

    Reach out to us for help