The official internal PHP utility library and Flight tooling reference for SuiteCRM .development. 16 UTIL FUNCTIONS 16 FLIGHT TOOLS Reference portal: flight.outrightcrm.com — login required Outright Utils is the internal PHP utility library built on top of SuiteCRM's core SDK.
The official internal PHP utility library and Flight tooling reference for SuiteCRM .development.
| 16 UTIL FUNCTIONS | 16 FLIGHT TOOLS |
Reference portal: flight.outrightcrm.com — login required
Outright Utils is the internal PHP utility library built on top of SuiteCRM's core SDK. Rather than repeating the same patterns across every project, the team consolidated the most commonly used operations such as bean retrieval, relationship handling, SQL execution, email dispatch, logging, and more into 16 globally available functions. This reference covers every function signature, its parameters, and how they combine in real-world workflows.
What is Outright Utils?
Internal PHP utility library for SuiteCRM development
Outright Utils is the internal PHP utility library developed and maintained by the team. It wraps commonly repeated SuiteCRM patterns into clean, reusable functions — reducing boilerplate and enforcing consistent patterns across all projects.
Think of it as the team's standard library on top of SuiteCRM's core SDK. All functions are globally available after the library is loaded.
flight.outrightcrm.com/search_utils.php — login required via Google or Microsoft
Learn More: Day 5: SuiteCRM SQL — MySQL & PHPMyAdmin Practice
All 16 Utility Functions
Complete reference with signatures, parameters, and usage descriptions
1. outright_retreive
outright_retreive( string $module, string $id ) : SugarBean|null
Retrieves a single SuiteCRM Bean record by module name and record ID. Returns null if not found or deleted.
PARAMETERS
$module Module name e.g. 'Accounts', 'Contacts'
$id UUID of the record to retrieve (CHAR 36)
2. outright_find_relationship_name
outright_find_relationship_name( string $parentModule, string $relatedModule ) : string|null
Finds and returns the relationship link name between two modules. Useful when you need the link name dynamically rather than hardcoding it.
PARAMETERS
$parentModule The parent/left-hand module name
$relatedModule The child/right-hand module name
3. outright_run_sql
outright_run_sql( string $sql ) : array
Executes a raw SQL query and returns all rows as an array of associative arrays. Always includes error handling and logging on failure.
PARAMETERS
$sql Full SQL string. Use addslashes() to sanitize user input
4. outright_run_sql_one_row
outright_run_sql_one_row( string $sql ) : array|null
Executes a SQL query and returns only the first row as an associative array. Returns .null if no rows found. Ideal for COUNT queries and single-record lookups.
PARAMETERS
$sql SQL query expected to return a single row result
5. outright_retreive_list
outright_retreive_list( string $module, string $where, string $order = '', int $limit = 20 ) : array
Fetches a list of Bean records from a module with optional WHERE clause, ORDER BY, and LIMIT. Returns an array of SugarBean objects.
PARAMETERS
$module Module name to query
$where SQL WHERE clause (without WHERE keyword)
$order ORDER BY e.g. 'date_modified DESC'
$limit Max records to return. Default: 20
6. outright_add_relationship
outright_add_relationship( SugarBean $parentBean, SugarBean $relatedBean, string $linkName ) : bool
Creates a relationship link between two Bean records using SuiteCRM's native relationship API. Fires all relationship hooks correctly.
PARAMETERS
$parentBean The parent Bean (left-hand side)
$relatedBean The related Bean (right-hand side)
$linkName Relationship link name e.g. 'contacts'
7. outright_send_email
outright_send_email( string $to, string $subject, string $body, array $options = [] ) : bool
Sends an email using SuiteCRM's configured outbound mail settings. Supports HTML body, CC/BCC, and attachments via options array.
PARAMETERS
$to Recipient email address
$subject Email subject line
$body HTML or plain-text body
$options ['cc','bcc','from_name','attachments']
8. outright_html_table_new
outright_html_table_new( array $headers, array $rows, array $options = [] ) : string
Generates an HTML table string from headers and data rows. Used for building dynamic email content, PDF reports, and inline HTML outputs.
PARAMETERS
$headers Array of column header strings
$rows 2D array of row data matching headers
$options ['class','style']
9. outright_return_fields_info
outright_return_fields_info( string $module ) : array
Returns detailed metadata for all fields in a given module — including type, label, required flag, default value, and options for dropdowns. Reads from vardefs.
PARAMETERS
$module Module name to inspect e.g. 'Accounts'
10. outright_get_module_fields
outright_get_module_fields( string $module ) : array
Returns a flat array of all field names for a given module. Lighter than outright_return_fields_info when you only need field names, not full metadata.
PARAMETERS
$module Module name to get field list for
11. outright_return_fields_by_type
outright_return_fields_by_type( string $module, string $type ) : array
Returns all fields of a specific type from a module's vardefs. Useful for finding all related fields, currency fields, or custom fields of a type.
PARAMETERS
$module Module name to search
$type Field type e.g. 'relate', 'currency', 'enum'
12. outright_print
outright_print( mixed $data, bool $die = false ) : void
Debug helper that pretty-prints any variable as formatted HTML output. Optionally halts execution after output. Use in development only.
PARAMETERS
$data Any PHP variable — string, array, object, bool, null
$die If true, calls die() after printing
13. outright_get_correct_bean
outright_get_correct_bean( string $module ) : SugarBean
Returns a fresh empty Bean instance for the given module name, handling custom module path resolution. Safer than calling BeanFactory::getBean() directly.
PARAMETERS
$module Works for both core and custom Outright modules
14. outright_do_repair
outright_do_repair( array $actions = ['all'] ) : array
Programmatically triggers SuiteCRM repair operations — Quick Repair & Rebuild, rebuild extensions, clear vardefs cache. Returns an array of results for each action.
PARAMETERS
$actions 'rebuild_vardefs', 'rebuild_extensions', 'clear_cache', or 'all'
15. outright_error_log
outright_error_log( string $message, string $level = 'error', array $context = [] ) : void
Writes a structured log entry to suitecrm.log with a consistent format including timestamp, level, and optional context data.
PARAMETERS
$message Human-readable log message
$level 'info', 'warn', 'error', 'debug'
$context Optional key-value array e.g. ['bean_id' => $id]
16. outright_load_relationship
outright_load_relationship( SugarBean $bean, string $linkName ) : array
Loads and returns all related Bean records through a named relationship link on a given bean. Handles load_relationship() internally and returns a clean array of related beans.
PARAMETERS
$bean The parent Bean object whose relationship to load
$linkName Link name in vardefs e.g. 'contacts
Usage Example — Combining Utils Functions
A real-world example using multiple utils together. The example below chains 8 util functions together:
- Retrieve an Account bean by ID
- Find the relationship link name dynamically
- Load all related Contact beans via that link
- Build rows for an HTML table
- Generate the HTML table string
- Send it as an email
- Run a COUNT query to get the total contacts
- Log the result to suitecrm.log
PHP
Retrieve an Account bean by ID
$account = outright_retreive('Accounts', $accountId);
// 2. Find the link name between Accounts and Contacts dynamically
$linkName = outright_find_relationship_name('Accounts', 'Contacts');
// 3. Load all related Contact beans via that link
$contacts = outright_load_relationship($account, $linkName);
// 4. Build rows for the HTML table
$rows = [];
foreach ($contacts as $c) {
$rows[] = [$c->first_name . ' ' . $c->last_name, $c->email1, $c->title];
}
// 5. Generate the HTML table string
$html = outright_html_table_new(['Name', 'Email', 'Title'], $rows);
// 6. Send it as an email
outright_send_email(
'manager@example.com',
'Contact List for ' . $account->name,
$html
);
// 7. Run a COUNT query to get the total
$row = outright_run_sql_one_row(
"SELECT COUNT(*) AS cnt FROM contacts WHERE account_id = '"
. addslashes($accountId) . "' AND deleted = 0"
);
// 8. Log the result to suitecrm.log
outright_error_log('Contact count: ' . $row['cnt'], 'info', ['account_id' => $accountId]);
Internal Flight Tools
Web-based scaffolding tools available at flight.outrightcrm.com
Emergency Entry Point
A special always-accessible entry point for critical server-side operations. Use when normal admin routes are unavailable — e.g. broken cache, locked-out admin, or a corrupt extension blocking the UI.
Access via /index.php?entryPoint=emergency with server-level credentials.
NEVER expose or share this endpoint externally. Treat it like a master key.
| # | TOOL NAME | VER | DESCRIPTION |
|---|---|---|---|
| 01 | Create Models | 1.0 | Generate a perfectly structured SuiteCRM Bean model — vardefs, metadata, and language files — in one click. The definitive starting point for any new custom module. |
| 02 | Create Dropdown Language File | 1.0 | Create dropdown language files by pasting CSV content directly or uploading a CSV file. Outputs ready-to-deploy PHP language arrays with correct array keys. |
| 03 | Manifest Generator | 1.0 | Build a valid manifest.php for Module Loader packages. Ensures the correct structure for installable zip deployments — no more hand-crafting manifest arrays. |
| 04 | Export Module | 1.0 | Export all Outright custom modules into a single deployable package. Ideal for migrating between staging and production environments. |
| 05 | Cron Job Creator | 1.0 | Scaffold a complete Scheduled Job without writing code — generates the function, scheduler registration entry, and language metadata file. |
| 06 | EntryPoint Builder | 1.0 | Generate a complete Entry Point package — registry file, handler PHP with security guard, and auth flag — without manually writing any code. |
| 07 | Fake Subpanel | 1.0 | Create SQL query-based subpanels that display custom data on any Detail View. Not limited to native SuiteCRM relationships — any SQL query can power the panel. |
| 08 | API Builder | 1.0 | Generate API field definitions and layouts for custom modules without writing vardef code. Point-and-click field configuration with immediate output. |
| 09 | Logic Hook Generator (Lite) | 1.0 | Scaffold basic Logic Hook registration files and handler class skeletons for any module and hook type — before_save, after_save, and more. |
| 10 | Logic Hook Generator (Premium) | 1.0 | Advanced hook generator with full template support — includes condition scaffolding, notification stubs, Google Chat integration, and multi-hook batching in one package. |
| 11 | Button Manager | 1.0 | Add custom action buttons to any view (DetailView, EditView, ListView, etc.) without editing core layout files manually. Configure label, action, and target module via UI. |
| 12 | Replace Manager | 1.0 | Clone an existing module package and perform a bulk key replacement across all files at once — e.g. swap every instance of gcal -> office365 to create a parallel integration. |
| 13 | Virtual Host Creator (VHOSTS) | 1.0 | Generate Apache or Nginx Virtual Host configuration files for new SuiteCRM instances with correct directory paths, permission settings, and SSL stubs. |
| 14 | Menu Manager | 1.0 | Create and manage module navigation menus instantly — add or reorder items in the top navigation bar without writing PHP extension files manually. |
| 15 | Outright Utils (v44) | 1.0 | The interactive reference and search tool for all Outright Utils functions. Browse signatures, parameter descriptions, and live usage examples. Always reflects the current installed version. |
| 16 | Code Generator | 1.0 | Generate fields, buttons, and UI components for any module without writing code. Input your requirements and receive deployable PHP output ready for the custom/ directory. |
Outright Utils — Internal Developer Reference | Dev Only
All 16 tools at flight.outrightcrm.com — Login with Google or Microsoft company account
Conclusion
Beyond the utility functions themselves, the Outright Utils ecosystem extends into Flight — a suite of 16 web-based scaffolding tools available at flight.outrightcrm.com. From generating Bean models and Logic Hooks to managing menus and virtual hosts, Flight eliminates repetitive manual work. Tool 15 serves as the interactive reference for Outright Utils itself, always reflecting the current installed version. Both resources together define the team's standard development workflow on SuiteCRM.
Respond to this article with emojis