Let the platform do the work

Health Check Error: Unsupported Method Call

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 "Unsupported method call" error reported by the health check.

Symptoms

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

Resolution

The generated error message will help determine the contents of the file causing the health check error. To address this issue, the code-level customization will need to be corrected or removed before proceeding with the upgrade.

The example error shown above was caused by a problem in the named file, ./custom/include/ChartReports/SummaryQuery.php. The example custom code uses a function, joinRaw(), which has been removed in Sugar 7.9 and above. We can see this on line 436 of the problematic file:

$this->query->joinRaw($joinStatement);
The following PHP methods and classes have been removed in version 7.9 and above in order to add future support for prepared statements. Any custom code using these methods will trigger a Health Check failure:
  • The following methods are deprecated. Use SugarQuery and SugarVisibility::addVisibilityQuery() instead:
    • SugarVisibility::addVisibilityFrom()
    • SugarVisibility::addVisibilityWhere()
    • SugarVisibility::addVisibilityFromQuery()
  • The following methods are deprecated. Use SugarQuery and BeanVisibility::addVisibilityQuery() instead:
    • BeanVisibility::addVisibilityFrom()
    • BeanVisibility::addVisibilityWhere()
    • BeanVisibility::addVisibilityFromQuery()
  • SugarQuery_Builder_Delete is deprecated. Use SugarBean::mark_deleted() instead.
  • The following classes are deprecated. Use SugarBean::save() instead:
    • SugarQuery_Builder_Insert
    • SugarQuery_Builder_Update
  • SugarQuery_Builder_Literal is deprecated with no replacement since this class was never fully implemented.
  • SugarQuery_Compiler is deprecated. Use SugarQuery_Compiler_SQL instead.
  • SugarQuery::joinRaw() is deprecated. Use SugarQuery::joinTable() instead. You can specify aliases and join types using parameters that will allow you to continue to specify any custom join.
  • SugarQuery::compileSql() is deprecated. Use SugarQuery::execute() instead.
  • The $execute parameter on DBManager::insertParams() is deprecated. In the future, insertParams() will always execute.
  • The $execute parameter on DBManager::updateParams() is deprecated. In the future, updateParams() will always execute.
  • The $where parameter on SugarBean::update() is deprecated. This parameter is not necessary.
  • DBManager::delete() is deprecated. Use SugarBean::mark_deleted() instead.
  • DBManager::retrieve() is deprecated. Use SugarBean::retrieve() instead.
  • DBManager::insertSQL() is deprecated. Use DBManager::insert() instead.
  • DBManager::updateSQL() is deprecated. Use DBManager::update() instead.
  • DBManager::deleteSQL() is deprecated. Use SugarBean::mark_deleted() instead.
  • DBManager::retrieveSQL() is deprecated. Use DBManager::retrieve() instead.
  • The following DBManager methods are no longer necessary:
    • DBManager::preparedQuery()
    • DBManager::pQuery()
    • DBManager::prepareQuery()
    • DBManager::prepareTypeData()
    • DBManager::prepareStatement() 

In order to proceed with the upgrade, either update or remove the offending line of code or disable the specified file so that it no longer references the removed method. For this example, use joinTable() instead of joinRaw().

$this->query->joinTable($joinStatement);

Once the necessary change has been made, please navigate to Admin > Repair and perform a "Quick Repair and Rebuild". Then, perform the health check again to confirm that the error is no longer reported.