SugarCRM SupportProduct GuidesSugar DeveloperSugar Developer Guide 10.3ArchitectureExtensionsUtils
This release is only available for SugarCloud customers.



The Utils extension adds functions to the global utility function list.


The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Application
Extension Directory ./custom/Extension/application/Ext/Utils/
Compiled Extension File ./custom/application/Ext/Utils/custom_utils.ext.php
Manifest Installdef $installdefs['utils']


The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/application/Ext/Utils/ to map a new action in the system. The following example will create a new function called 'exampleUtilFunction' that can be used throughout the system:



function exampleUtilFunction()    '

Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and your customizations will be compiled into ./custom/application/Ext/Utils/custom_utils.ext.php .

Alternatively, functions can also be added by creating ./custom/include/custom_utils.php. This method of creating utils is still compatible but is not recommended from a best practices standpoint.

Module Loadable Package

When building a module loadable package, you can use the $installdefs['utils'] index to install the extension file.

Installdef Properties

Name Type Description
from String The base path of the file to be installed

The example below demonstrates the proper install definition that should be used in the ./manifest.php file in order to add the utils to the system. You should note that when using this approach, Sugar will automatically execute Rebuild Extensions to reflect the new utils in the system.



$manifest = array(

$installdefs = array(
    'id' => 'utils_Example',
    'utils' => array(
            'from' => '<basepath>/Files/custom/Extension/application/Ext/Utils/<file>.php',

Alternatively, you may use the $installdefs['copy'] index to copy the file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module-loadable packages, please refer to the Introduction to the Manifest page.

Last modified: 2021-01-06 23:28:41