SugarApplication

Overview

An overview of the SugarApplication class used to help manage tasks for the controller and views.

Displaying Error Messages

Sometimes error messages or notices need to be displayed to users, however, the executing logic cannot be exited. When this happens you can use the method appendErrorMessage() to display message to the user once the next view loads. An example is shown below:
SugarApplication::appendErrorMessage("{$message}");

Redirecting Users

To redirect a user to a new page, you can use the redirect() method. This method will handle exiting the code for you. An example is shown below:
$urlParameters = array(  'module' => $module,  'action' => $action,);$url = 'index.php?' . http_build_query($urlParameters);SugarApplication::redirect($url);