Health Check Error: $this usage

    Overview

    The Health Check wizard must be run when upgrading in order to evaluate your instance’s ability to move to the target version. 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 “$this usage” error reported by the health check.

    Symptoms

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

    thisUsage

    Resolution

    In this example, the function, $this, identified in the health check error is found in the ./custom/Extension/modules/Accounts/Ext/Layoutdefs/accounts_bugs_1_Accounts.php file. The line of code referencing this hook is as follows:

    'account_id' => $this->_focus->id, 

    The target version of Sugar does not support using $this objects in the metadata. In order to proceed with the upgrade, either update or remove the offending line of code in the specified file so that it no longer utilizes the $this object.

    Once the necessary change has 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.

    PatrickM
    in Troubleshooting Health Check Output

    Reach out to us for help