DescriptionDetermines whether to mark an email as read before importing the email to Sugar during the inbound email import. This is not recommended as an import failure will cause the email to be marked as read which will be skipped during the next inbound email import.TypeBooleanRange of valuestrue and falseVersions6.5.17+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['mark_emails_seen'] = true;mass_actions
DescriptionArray that defines mass action behaviors.TypeArrayVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['mass_actions'] = array();mass_actions.mass_delete_chunk_size
DescriptionNumber of records per chunk while performing a mass delete.TypeIntegerVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value20Override Example$sugar_config['mass_delete_chunk_size'] = 20;mass_actions.mass_link_chunk_size
DescriptionNumber of records per chunk while performing mass linking updates.TypeIntegerVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value20Override Example$sugar_config['mass_actions']['mass_link_chunk_size'] = 20;mass_actions.mass_update_chunk_size
DescriptionNumber of records per chunk while performing a mass update.TypeIntegerVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value500Override Example$sugar_config['mass_actions']['mass_update_chunk_size'] = 500;mass_actions.max_records_to_merge
DescriptionNumber of records per chunk while performing a mass merge.TypeIntegerVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value5Override Example$sugar_config['mass_actions']['max_records_to_merge'] = 20;maxPinnedModules
DescriptionThe number of pinned modules to be displayed on the navigation bar (in the collapsed state).


DescriptionThe number of pinned modules to be displayed on the navigation bar (in the collapsed state).
Note: For Sugar versions 13.0.0 and higher, the number of pinned modules can also be configured via Admin > Navigation Bar and Subpanels. Instances running on Sugar's cloud environment will have this setting enforced as 4.TypeIntegerVersions12.3.0+ProductsEnterprise, Serve, SellDefault Value4SugarCloud Value4Override Example$sugar_config['maxPinnedModules'] = 6;max_aggregate_email_attachments_bytes
DescriptionThe maximum allowed size of all uploaded attachments added together for a single email message. Users may upload files as email attachments within to the lowest of the PHP upload_max_filesize, post_max_size, and system upload_maxsize size limits, but users cannot upload more files to a single message than the max_aggregate_email_attachments_bytes configuration permits.TypeInteger : bytesVersions7.10.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10000000Override Example$sugar_config['max_aggregate_email_attachments_bytes'] = 20000000;max_session_time
DescriptionDetermines the maximum lock time in seconds between session requests. When a session request is locked for long periods of time, other requests are blocked until it is released. A null value will not implement a max session time. Instances running on Sugar's cloud environment will have this setting enforced as 1.TypeInteger : SecondsVersions6.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuenullSugarCloud Value1Override Example$sugar_config['max_session_time'] = 1;metrics_enabled
DescriptionWhether or not system metrics have been enabled.TypeBooleanRange of valuestrue and falseVersions6.7.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['metrics_enabled'] = true;metric_providers


DescriptionA Name/Path array of metric providers for measuring system metricsTypeArrayVersions6.7.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['metric_providers'] = array ('provider' => 'path/to/provider');metric_settings
DescriptionThe individual settings required by a metric provider. And values provided will be passed when instantiating the metric providers object.TypeArray : Metric Provider SettingsVersions6.7.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['metric_settings'] = array ('provider' => array('setting' => 'value'));minify_resources
DescriptionDetermines whether minification and compression are applied to javascript resourcesTypeBooleanRange of valuestrue and falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['minify_resources'] = false;moduleInstaller
DescriptionArray that defines restrictions on module installations via the Module Loader utility.TypeArrayVersions5.2.0.j+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['moduleInstaller'] = array();moduleInstaller.disableActions
DescriptionPart of the moduleInstaller array. When packageScan is set to 'true', Sugar does not restrict any specific actions that can be completed during the installation process. The disableActions parameter allows you to define any actions you wish to restrict from executing.TypeArrayRange of valuesSpecific actions to restrict in module packagesVersions5.2.0j+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Valuearray()Override Example$sugar_config['moduleInstaller']['disableActions'] = array('pre_execute', 'post_execute');moduleInstaller.disableFileScan


DescriptionWhen packageScan is set to 'true', Sugar scans all files in an installable package to ensure that the file extensions are acceptable and that the files do not contain denylisted class or function calls. Setting the disableFileScan parameter to 'true' avoids this scan from occurring while still enforcing other parameters set.TypeBooleanRange of valuestrue and falseVersions5.2.0j+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['moduleInstaller']['disableFileScan'] = true;moduleInstaller.packageScan
DescriptionEnables package scanning on any modules uploaded through Module Loader prior to the installation. If the package is found to violate any restrictions of the packageScan, the installation will not proceed and an error report will be generated to the user attempting the install. Instances running on Sugar's cloud environment will have this setting enforced as true.TypeBooleanRange of valuestrue and falseVersions5.5.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseSugarCloud ValuetrueOverride Example$sugar_config['moduleInstaller']['packageScan'] = true;moduleInstaller.validExt


DescriptionPart of the moduleInstaller array. When moduleInstaller.packageScan is set to true, Sugar will not allow certain file extensions to be present in an installable package. By default, Sugar allows the following extensions: 'png', 'gif', 'jpg', 'css', 'js', 'php', 'txt', 'html', 'htm', 'tpl', 'pdf', 'md5', 'xml', 'hbs', 'less', and 'wsdl'. This parameter allows you to define additional extensions deemed safe to install on your instance of Sugar.  Instances running on Sugar's cloud environment will have this setting enforced as array('eot','svg','tff','woff','woff2','xml','md').TypeArray : ExtensionsRange of valuesFile extensions to allowVersions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Valuearray()SugarCloud Valuearray('eot','svg','tff','woff','woff2','xml','md')Override Example$sugar_config['moduleInstaller']['validExt'] = array('swf', 'log');mso_fixup_paragraph_tags
DescriptionDetermines whether email HTML is scrubbed for empty paragraph tags when displayed in the application. Setting this value to true will enable the HTML scrubbing. Enabling this setting does not affect the HTML stored in the database from the initial import. Created as a result of bug 66022 (https://web.sugarcrm.com/support/issues/66022).TypeBooleanRange of valuestrue and falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['mso_fixup_paragraph_tags'] = true;new_email_addresses_opted_out


DescriptionIf true, then newly created EmailAddress records in Sugar will be opted-out by default. This setting can also be controlled using the "Opt-out new email addresses by default" setting in Admin > System Email Settings.TypeBooleanRange of valuestrue and falseVersions8.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['new_email_addresses_opted_out'] = true;noPrivateTeamUpdate
DescriptionPrevents name changes to a users private team. This setting can be modified by changing in Admin > System Settings > Advanced > Prevent name changes by users to update their Private Team NameTypeBooleanRange of valuestrue and falseVersions7.6.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['noPrivateTeamUpdate'] = true;oauth2
DescriptionConfigutations for the oauth2 server.TypeArrayVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['oauth2'] = array();oauth2.access_token_lifetime
DescriptionThe lifetime of the access token in seconds.  This setting controls how often Sugar will check to see if the user's token has expired. It is recommended for this value not to surpass more than half of the oauth2.refresh_token_lifetime setting. Note: This setting cannot exceed the maximum PHP session timeout, which is configured by PHP setting session.gc_maxlifetime. In SugarCloud the maximum session timeout is set to 7200s (2 hours).Note: This setting is not respected for instances that use SugarIdentity.TypeInteger : SecondsVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value3600Override Example$sugar_config['oauth2']['access_token_lifetime'] = 3600;oauth2.refresh_token_lifetime


DescriptionThe lifetime of refresh token in seconds. We recommend the oauth2.refresh_token_lifetime remains at 1209600 seconds or less for security. Should you increase this number, do not exceed 2147220 seconds. Note: This setting is not respected for instances that use SugarIdentity.TypeIntegerVersions7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value1209600Override Example$sugar_config['oauth2']['refresh_token_lifetime'] = 1409600;oauth_token_expiry
DescriptionSets whether OAuth tokens will expire.TypeStringRange of valuestrue and falseVersions7.5.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueFalseOverride Example$sugar_config['oauth_token_expiry'] = '0';oauth_token_life
DescriptionSets the length (in seconds) of the life of an OAuth token.TypeInteger : SecondsVersions7.5.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value86400Override Example$sugar_config['oauth_token_life'] = '86400';passwordHash
DescriptionArray that defines the password hashing behaviors.
Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeArrayVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['passwordHash'] = array();passwordHash.algo
DescriptionThe specific algorithm to be used by the hashing backend. The available values depend on the selected passwordHash.backend. See http://php.net/manual/en/password.constants.php for more information when using the native backend.


Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeString : Algorithm TypeRange of valuesFor native backend:  "PASSWORD_DEFAULT" and "PASSWORD_BCRYPT".   For sha2 backend:  "CRYPT_SHA256" and "CRYPT_SHA512"Versions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value"PASSWORD_DEFAULT" for native. "CRYPT_SHA256" for sha2 backend.Override Example$sugar_config['passwordHash']['algo'] = 'PASSWORD_BCRYPT';passwordHash.allowLegacy
DescriptionAllow logins of users who have their password stored using the insecure legacy MD5 hash. During the transition period for the 7.7 series, this will be allowed out of the box. Versions past 7.7 will no longer allow by default authentication against insecure hashes. This configuration parameter can be used to change the default behavior.
Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeBooleanRange of valuestrue and falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value7.7.x: true7.8.x+:falseOverride Example$sugar_config['passwordHash']['allowLegacy'] = false;passwordHash.backend
DescriptionThe password hash backend class to use. By default, the "native" backend is used which uses Blowfish to hash the passwords in the database. An alternative is using the "sha2" backend which makes use of SHA-2 hashing instead. Depending on the backend, different configuration options are available for passwordHash.algo and passwordHash.options.


Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeStringRange of values'sha2' and 'native'Versions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuenativeOverride Example$sugar_config['passwordHash']['backend'] = 'sha2';passwordHash.options
DescriptionThe available configuration values depend on the selected passwordHash.backend. See http://php.net/manual/en/function.password-hash.php when using the native backend and http://php.net/manual/en/function.crypt.php for the sha2 backend. Note that only the following specified options are allowed. For native backend: passwordHash.options.cost. For sha2 backend: passwordHash.options.rounds.
Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeArrayVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['passwordHash']['options'] = array();passwordHash.options.cost
DescriptionAn available option when the passwordHash.backend configuration is set to "native". More information on the native backend can be found at http://php.net/manual/en/function.password-hash.php
Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeIntegerVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['passwordHash']['options']['cost'] = 15;passwordHash.options.rounds
DescriptionAn available option when the passwordHash.backend configuration is set to "sha2". More information on the sha2 backend can be found at http://php.net/manual/en/function.crypt.php


Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeIntegerVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value5000Override Example$sugar_config['passwordHash']['options']['rounds'] = 4000;passwordHash.rehash
DescriptionWhen enabled, the system will automatically rehash the user's password when successfully authenticated. This allows adoption to the newly configured password hash backend without resetting user's passwords.
Note: This configuration's functionality has been deprecated in Sugar versions 13.0 and higher and will be removed in a future release.TypeBooleanRange of valuestrue and falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['passwordHash']['rehash'] = false;passwordsetting
DescriptionDefines all of the password requirements for the instance.TypeArrayVersions5.5.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['passwordsetting'] = array();passwordsetting.forgotpasswordON
DescriptionEnables the Forgot Password features. When enabled, users will have the ability to reset their own passwords at the Login page. Set in UI via Admin->Password Management.TypeStringRange of values0, 1Versions5.5.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value1Override Example$sugar_config['passwordsetting']['forgotpasswordON'] = '0';passwordsetting.linkexpiration
DescriptionDetermines whether the password reset link expires.TypeStringRange of values0, 1Versions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value0Override Example$sugar_config['passwordsetting']['linkexpiration'] = '0';passwordsetting.onelower


DescriptionConfigures whether at least one lower-case letter is required in users' passwords.TypeStringRange of values0, 1Versions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value0Override Example$sugar_config['passwordsetting']['onespecial'] = '0';passwordsetting.onenumber
DescriptionConfigures whether at least one number is required in users' passwords.TypeStringRange of values0, 1Versions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value1Override Example$sugar_config['passwordsetting']['onenumber'] = '1';passwordsetting.oneupper
DescriptionConfigures whether at least one upper-case letter is required in users' passwords.TypeBooleanRange of values0, 1Versions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value0Override Example$sugar_config['passwordsetting']['oneupper'] = 1;passwordsetting.systexpirationtype
DescriptionSpecifies the unit of measurement for passwordsetting.systexpirationtime. The available options are: Days (1), Weeks (7) and Months (30). This value can be set in the UI via Admin > Password Management.TypeIntegerRange of values1, 7, and 30Versions5.5.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value1Override Example$sugar_config['passwordsetting']['systexpirationtype'] = '7';pdf_file_max_lifetime
DescriptionThe interval in seconds of when to expire and remove generated PDF files. It is important to note that the "Remove temporary PDF files" scheduler job must be enabled to remove the PDF files.TypeInteger : SecondsVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value86400Override Example$sugar_config['pdf_file_max_lifetime'] = 86400;perfProfile


DescriptionAllows for an admin to tweak aspects of the system for performance enhancements when fetching records. As every system is different, your mileage will vary when using the perfProfile settings. Increases or decreases in performance will depend on a combination of primarily the amount of users, amount of unique team sets, and data size per module. The perfProfile parameters are available to be able to fine tune the team security performance no your platform. It is not recommended to change any setting directly in a production environment without testing and understanding the impact.TypeArrayVersions7.2.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['perfProfile'] = array();perfProfile.TeamSecurity
DescriptionDetermines whether the team security filtering is applied.TypeArrayVersions7.2.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['perfProfile']['TeamSecurity'] = array();perfProfile.TeamSecurity.default
DescriptionThis setting is used to enable or disable Team Security denormalization feature by default across the application.TypeArrayRange of valuestrue and falseVersions7.7.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['perfProfile']['TeamSecurity']['default'] = array();perfProfile.TeamSecurity.default.disable_subquery_optimizer_hint


DescriptionAs of Sugar 11.0.2, the default behavior of TeamSecurity on MySQL no longer uses an INNER JOIN to a 'team_sets' subquery; instead, Sugar 11.0.2 and higher use WHERE team_set_id IN [team_sets subquery] with a MySQL optimizer hint. To disable this approach and switch back to the INNER JOIN implementation, set this config to 'true'.TypeBooleanRange of valuestrue and falseVersions11.0.2+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['default']['disable_subquery_optimizer_hint'] = true;perfProfile.TeamSecurity.default.teamset_prefetch
DescriptionFetches the list of team sets that the current user is a member of in a separate query and use those ID's directly in the team security clause to avoid adding a subquery. Under certain conditions, this may improve team security performance.
It is important to note that 'default' applies this applied to all modules. To set specific settings for a specific module, you will need to use:
$sugar_config['perfProfile']['TeamSecurity']['{module}']['teamset_prefetch'] = true;TypeBooleanRange of valuestrue and falseVersions7.2.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['default']['teamset_prefetch'] = true;perfProfile.TeamSecurity.default.teamset_prefetch_max
DescriptionThe maximum amount of team set ID's to include in the team security clause. If the current user is a member of more unique teams sets than this value, the system will fall back to using a regular subquery instead. Under certain conditions, this may improve team security performance.


It is important to note that 'default' applies this applied to all modules. To set specific settings for a specific module, you will need to use:
$sugar_config['perfProfile']['TeamSecurity']['{module}']['teamset_prefetch_max'] = true;TypeInteger : RecordsVersions7.2.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueemptyOverride Example$sugar_config['perfProfile']['TeamSecurity']['default']['teamset_prefetch_max'] = 500;perfProfile.TeamSecurity.default.use_denorm
DescriptionThis setting is used to enable or disable Team Security denormalization feature. Team Security denormalization can significantly improve SQL query performance when there are a large number of Teams in a Sugar instance. The cost is that this feature relies on a separate Team security denormalization table that needs to be updated as records change to ensure Sugar's Team security visibility rules are applied properly.
It is important to note that 'default' applies this to all modules. To set specific settings for a specific module, you will need to use:
$sugar_config['perfProfile']['TeamSecurity']['{module}']['use_denorm'] = true;TypeBooleanRange of valuestrue and falseVersions8.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['default']['use_denorm'] = true;perfProfile.TeamSecurity.default.where_condition
DescriptionDetermines whether the team security filtering is applied in the WHERE clause instead of SELECT clause. Under certain conditions, this may improve team security performance.
It is important to note that 'default' applies this applied to all modules. To set specific settings for a specific module, you will need to use:


$sugar_config['perfProfile']['TeamSecurity']['{module}']['where_condition'] = true;TypeBooleanRange of valuestrue and falseVersions7.2.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['default']['where_condition'] = true;perfProfile.TeamSecurity.gs_use_normalized_teams
DescriptionDetermines whether the team set IDs are cached; this may improve Elasticsearch indexing performance, especially for those instances with a large number of team sets per user. Admin must schedule re-indexing Elasticsearch server if this value has been changed.TypeBooleanRange of valuestrue and falseVersions11.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['gs_use_normalized_teams'] = true;perfProfile.TeamSecurity.inline_update
DescriptionWhen denormalization is in use (perfProfile.TeamSecurity.default.use_denorm config set to true), this setting will allow the denormalization table to be updated in real time as records are updated in the system. If this setting is disabled, the denormalization table must be scheduled by the Sugar administrator via Schedulers > Rebuild Denormalized Team Security Data.TypeBooleanRange of valuestrue and falseVersions8.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['perfProfile']['TeamSecurity']['inline_update'] = true;pmse_settings_default
DescriptionSettings for troubleshooting and debugging SugarBPMTypeArrayVersions7.6.0.0+ProductsEnterprise, Ultimate, Serve, SellOverride Example$sugar_config['pmse_settings_default'] = array();pmse_settings_default.error_number_of_cycles


DescriptionNumber of cycles before triggering an error in SugarBPMTypeString : CyclesVersions7.6.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['pmse_settings_default']['error_number_of_cycles'] = 15;pmse_settings_default.error_timeout
DescriptionTime in seconds of timeout before triggering an error in SugarBPMTypeString : SecondsVersions7.6.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault Value40Override Example$sugar_config['pmse_settings_default']['error_timeout'] = 45;pmse_settings_default.logger_level
DescriptionThe default logger level for SugarBPMTypeStringRange of valuesemergency, alert, critical, error, warning, notice, info, debugVersions7.6.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuecriticalOverride Example$sugar_config['pmse_settings_default']['logger_level'] = 'emergency';portal_enableSelfSignUp
DescriptionThis portal configuration option controls whether external portal sign-ups are permitted and is also controlled in the user interface via the "Allow new users to sign up" Sugar Portal setting. See the Sugar Portal page in the Administration Guide for details on this setting: https://support.sugarcrm.com/SmartLinks/Administration_Guide/Developer_Tools/Sugar_Portal/hdr_Configure_Portal
This option is disabled by default for new instances. Note: Upon upgrade to 11.1.0 or higher from version 11.0.x or lower, the default value will be 'true' for instances that had their portal enabled before upgrade and at least one contact configured for portal.TypeBooleanRange of valuestrue and falseVersions11.1.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['portal_enableSelfSignUp'] = true;processes_auto_save_interval


DescriptionDefines the interval (in milliseconds) at which auto-saving of process definitions will occur while using the SugarBPM process designer. A value of 0 will disable auto-saving.TypeInteger : MillisecondsVersions8.3.0+ProductsEnterprise, Ultimate, Serve, SellDefault Value30000Override Example$sugar_config['processes_auto_save_interval'] = 120000processes_auto_validate_on_autosave
DescriptionDefines whether validation of process definitions will automatically occur when a process definition is auto-saved. To enable this setting, 'processes_auto_save_interval' must be greater than 0.TypeBooleanRange of valuestrue and falseVersions8.3.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['processes_auto_validate_on_autosave'] = falseprocesses_auto_validate_on_import
DescriptionDetermines whether validation of process definitions will automatically occur immediately after a process definition is imported.TypeBooleanRange of valuestrue and falseVersions8.3.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['processes_auto_validate_on_import'] = falseproxy_visible
DescriptionDetermines whether the Proxy Settings panel is visible to administrators in Admin > System Settings. Instances running on Sugar's cloud environment will have this setting enforced as false. Instances running on Sugar's cloud environment will have this setting enforced as false.TypeBooleanRange of valuestrue or falseVersions11.3.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueSugarCloud ValuefalseOverride Example$sugar_config['proxy_visible'] = false;push_notification
DescriptionThe array of configurations related to push notifications.TypeArrayVersions11.0.0+ProductsEnterprise, Ultimate, Serve, SellOverride Example$sugar_config['push_notification'] = array();push_notification.enabled


DescriptionFor Sugar instances that are eligible for push notifications, use this setting to turn push notifications on or off. See the Android and iOS User Guides for the requirements to be eligible:
https://support.sugarcrm.com/Documentation/Mobile_Solutions/SugarCRM_Mobile/SugarCRM_Mobile_for_iOS_User_Guide/#Eligible_Sugar_Instances
https://support.sugarcrm.com/Documentation/Mobile_Solutions/SugarCRM_Mobile/SugarCRM_Mobile_for_Android_User_Guide/#Eligible_Sugar_InstancesTypeBooleanRange of valuestrue and falseVersions11.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['push_notification']['enabled'] = true;push_notification.service_provider
DescriptionFor Sugar instances that are eligible for push notifications, this setting specifies the provider. Currently, SugarPush is the only available provider. See the Android and iOS User Guides for the requirements to be eligible:
https://support.sugarcrm.com/Documentation/Mobile_Solutions/SugarCRM_Mobile/SugarCRM_Mobile_for_iOS_User_Guide/#Eligible_Sugar_Instances
https://support.sugarcrm.com/Documentation/Mobile_Solutions/SugarCRM_Mobile/SugarCRM_Mobile_for_Android_User_Guide/#Eligible_Sugar_InstancesTypeStringRange of values'SugarPush'Versions11.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault Value'SugarPush'Override Example$sugar_config['push_notification']['service_provider'] = 'SugarPush';reports_complexity_display
DescriptionArray that establishes the thresholds for the number of cells in a report above which the formatting changes.TypeArrayRange of valuesPositive integersVersions13.0.0+ProductsEnterprise, Serve, SellOverride Example$sugar_config['reports_complexity_display'] = array();reports_complexity_display.export


DescriptionWhen a report has more than this many cells, you will only be able to view results in a table by exporting the table.TypeInteger : Number of cellsRange of valuesAny integer greater than or equal to 1Versions13.0.0+ProductsEnterprise, Serve, SellDefault Value300000Override Example$sugar_config['reports_complexity_display']['export']=30000;reports_complexity_display.simplified
DescriptionWhen a report has more than this many cells, you will be able to view results as a simplified table or export the results. TypeInteger : Number of cellsRange of valuesAny integer greater than or equal to 1Versions13.0.0+ProductsEnterprise, Serve, SellDefault Value50000Override Example$sugar_config['reports_complexity_display']['simplified']=5000;require_accounts
DescriptionDetermines whether an account is required for record creation within the system.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['require_accounts'] = false;rest_response_etag_cache_age
DescriptionControls how long the browser should cache rest responses.TypeInteger : SecondsVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['rest_response_etag_cache_age'] = 15;roleBasedViews
DescriptionEnables role based views and dropdowns.TypeBooleanRange of valuestrue and falseVersions7.6.0.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['roleBasedViews'] = true;SAML_provisionUser


DescriptionThe maximun number of records that can be deleted at a time.TypeInteger : Number of recordsVersions7.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value3000Override Example$sugar_config['search_engine']['max_bulk_delete_threshold'] = 3000;search_engine.max_bulk_query_threshold
DescriptionThe maximum number of records to process before starting to bulk insert. Prevents memory issues.TypeInteger : Number of recordsVersions7.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value15000Override Example$sugar_config['search_engine']['max_bulk_query_threshold'] = 20000;search_engine.max_bulk_threshold
DescriptionThe maximum number of records to process before starting to bulk insert. Prevents memory issues.TypeIntegerVersions7.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value5000Override Example$sugar_config['search_engine']['search_engine.max_bulk_threshold'] = 10000;search_engine.postpone_job_time
DescriptionAmount of time to postpone a job by so that it's not executed twice during the same request.TypeInteger : SecondsVersions7.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value120Override Example$sugar_config['search_engine']['search_engine.postpone_job_time'] = 70;search_wildcard_infront
DescriptionIn Sugar 7.x+, this setting is only valid for modules running in BWC mode. When enabled, automatically adds a wildcard in front of any searches performed in the application. This setting is not recommended to be enabled as preceding wildcards results in database indices not being utilized and performance decreasing.TypeBooleanRange of valuestrue and falseVersions6.4.3+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['search_wildcard_infront'] = true;security.private_ips


DescriptionDefines a range of IPs considered to be private. Such IPs and corresponding domains are not reachable via ExternalResourceClient. Instances running on Sugar's cloud environment will have this setting enforced as ['10.0.0.0|10.255.255.255', '172.16.0.0|172.31.255.255', '192.168.0.0|192.168.255.255', '169.254.0.0|169.254.255.255', '127.0.0.0|127.255.255.255',].TypeArrayRange of valuesPipe-delimited range of IPs (e.g., '10.0.0.0|10.255.255.255')Versions12.1.0+ProductsEnterprise, Serve, SellDefault Value['10.0.0.0|10.255.255.255', '172.16.0.0|172.31.255.255', '192.168.0.0|192.168.255.255', '169.254.0.0|169.254.255.255', '127.0.0.0|127.255.255.255',]SugarCloud Value['10.0.0.0|10.255.255.255', '172.16.0.0|172.31.255.255', '192.168.0.0|192.168.255.255', '169.254.0.0|169.254.255.255', '127.0.0.0|127.255.255.255',]Override Example$sugar_config['security']['private_ips'] = [ '127.0.0.0|127.255.255.255', '8.8.8.0|8.8.8.8', ];security.use_doh


DescriptionEnables remote Domain Name System (DNS) resolution via the HTTPS protocol. A goal of the method is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data by man-in-the-middle attacks by using the HTTPS protocol to encrypt the data between the DoH (DNS over HTTPS) client and the DoH-based DNS resolver.
When enabled, it will use dns.google (8.8.4.4) to resolve hostnames. Instances running on Sugar's cloud environment will have this setting enforced as false.TypeBooleanRange of valuestrue and falseVersions13.0.0+ProductsEnterprise, Serve, SellDefault ValuefalseSugarCloud ValuefalseOverride Example$sugar_config['security']['use_doh'] = true;session_dir
DescriptionDirectory on the server to store Sugar session data. If left empty, the PHP session settings will be inherited. Instances running on Sugar's cloud environment will have this setting enforced as empty.TypeStringRange of valuesDirectory pathVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueemptySugarCloud ValueemptyOverride Example$sugar_config['session_dir'] = '/tmp/SugarSession/';showThemePicker
DescriptionRemoves the theme selection drop down.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['showThemePicker'] = false;show_download_tab
DescriptionUsed to determine whether the download tab will appear in the User settings. The download tab provides users with access to Sugar plug-ins and other available downloads.TypeBooleanRange of valuestrue and falseVersions6.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['show_download_tab'] = true;site_url


DescriptionCurrent URL of your Sugar instance. This value is critical in its accuracy for multiple points of functionality in the instance.TypeString : URLRange of valuesCurrent URL of SugarVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['site_url'] = 'http://my.sugarinstance.com';slow_query_time_msec
DescriptionSlow query time threshold. Instances running on Sugar's cloud environment will have this setting enforced as 5000.TypeString : MillisecondsVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value5000SugarCloud Value5000Override Example$sugar_config['slow_query_time_msec'] = '1000';smtp_mailer_debug
DescriptionThe smtp_mailer_debug is used for increasing the debugging output for PHPMailer on individual instances so that more information can be seen when there are bugs or escalations. The default is 0 and produces no additional output for errors. 1-4 log the additional error information to sugarcrm.log as specified by PHPMailer at https://github.com/PHPMailer/PHPMailer/wiki/SMTP-Debugging#debug-levels .
TypeIntegerRange of values0, 1, 2, 3, 4Versions7.9.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value0Override Example$sugar_config['smtp_mailer_debug'] = 4;stack_trace_errors
DescriptionDisplays stack trace of errors. Instances running on Sugar's cloud environment will have this setting enforced as false.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseSugarCloud ValuefalseOverride Example$sugar_config['stack_trace_errors'] = true;studio_max_history


DescriptionWhen layout changes are made in Studio, a history of those changes are recorded with each save & deploy under ./custom/history/modules/. The studio_max_history parameter controls how many files Sugar keeps for a particular module. If this parameter is undefined, a default of 50 is observed and to keep all historical Studio actions, set this parameter to 0. Instances running on Sugar's cloud environment will have this setting enforced as 50.TypeInteger : Number of files to keepRange of valuesAny integerVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value50SugarCloud Value50Override Example$sugar_config['studio_max_history'] = 100;sugar_version
DescriptionThe current version of Sugar that is being used. This value should not be modified as it is updated in the config when Sugar is upgraded.TypeString : Version NumberVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['sugar_version'] = '6.7.3';symfony_deprecation_log
DescriptionBy default, the deprecation warnings, triggered by Symfony components, are written to sugarcrm.log in the Sugar root directory. But since the default log level is set to Fatal, the deprecation warning messages will not appear in the log. As an option, you can add the $sugar_config['logger']['channels']['deprecation'] configuration and configure the log level and output method to just capture the deprecation warnings in a separate deprecations.log file.   Instances running on Sugar's cloud environment will have this setting enforced as false.TypeBooleanRange of valuestrue and falseVersions12.2.0+ProductsEnterprise, Ultimate, Serve, SellDefault ValuefalseSugarCloud ValuefalseOverride Example$sugar_config['symfony_deprecation_log'] = true;time_aware_job_max_batch_size


DescriptionThe number of records processed per batch by the "Process Time-Aware Schedules" job scheduler.  It is important to note that the scheduler job must be enabled.TypeInteger : RecordsVersions10.3.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value100Override Example$sugar_config['time_aware_job_max_batch_size'] = 200;tmp_dir
DescriptionThe directory path for temporary XML files used by charts and diagnostics.TypeString : Directory pathRange of valuesFilesystem pathVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Valuecache/xml/Override Example$sugar_config['tmp_dir'] = 'cache/xml/';tmp_file_max_lifetime
DescriptionThe interval in seconds of when to expire and remove temporary upload files. It is important to note that the "Remove temporary files" scheduler job must be enabled to remove the temporary files.TypeInteger : SecondsVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value86400Override Example$sugar_config['tmp_file_max_lifetime'] = 86400;tracker_max_display_length
DescriptionThe number of records that will be shown per record in the "Last Viewed" section located under each module tab.TypeInteger : Number of recordsVersions6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['tracker_max_display_length'] = 45;tracker_module_config
DescriptionArray that defines the parameters that control which modules are tracked when Tracker Actions are enabled.TypeArrayVersions11.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['tracker_module_config'] = array();tracker_module_config.disable


DescriptionThe list of modules that are ignored by Tracker Actions. If tracker_module_config.enable_only is defined, then tracker_module_config.disable will be ignored. If neither config is defined, then all modules are enabled. By default, neither config is defined and all actions for all modules across all platforms will be enabled when Tracker Actions is enabled.TypeArrayRange of valuesModule keysVersions11.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['tracker_module_config']['disable'] = ['Reports', 'ActivityStream'];tracker_module_config.enable_only
DescriptionA list of module names for which records are saved in the tracker table when Tracker Actions are enabled; all other modules will be disabled. If tracker_module_config.enable_only is empty or null or undefined, tracker_module_config.disable will apply. If neither config is defined, then all modules are enabled. By default, neither config is defined and all actions for all modules across all platforms will be enabled when Tracker Actions is enabled.
TypeArrayRange of valuesModule keysVersions11.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['tracker_module_config']['enable_only'] = ['Reports', 'ActivityStream'];uninstallOnError
DescriptionToggles the switch that uninstalls the package that was just installed if the install ended up with a PHP error.  Instances running on Sugar's cloud environment will have this setting enforced as true.TypeBooleanRange of valuestrue and falseVersions12.0.3+ProductsEnterprise, Ultimate, Serve, SellDefault ValuetrueSugarCloud ValuetrueOverride Example$sugar_config['uninstallOnError'] = false;uninstall_timeout
DescriptionControls the timeout time in seconds for an uninstall process.TypeInteger : SecondsVersions10.2.1+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value600Override Example$sugar_config['uninstall_timeout'] = 300;unique_key


DescriptionSpecifies the unique identifier for the instance. This value is used in features such as PHP caching, FTS indexing, and email archiving. It is extremely important that this string is unique from any other instances deployed even if they are only for development purposes only.TypeString : Unique IdentifierVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['unique_key'] = 'c0b5475f3f5b26ddb2976edc8865b5f6';upload_badext
DescriptionAn array of extensions that cannot be uploaded in their native file format. Sugar will append a .txt extension to the end of any files with an invalid extension to avoid security issues with running unauthorized scripts on an instance.TypeArrayRange of valuesExtensions that cannot be uploaded as isVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['upload_badext'][] = 'swf';upload_dir
DescriptionThe directory path where uploaded files are stored for note attachments, documents, and module loadable packages. By default, uploads are stored in the ./upload/ directory. For more information, refer to the Uploads documentation.TypeStringRange of valuesDirectory pathVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Valueupload/Override Example$sugar_config['upload_dir'] = 'upload/'upload_maxsize


DescriptionThe maximum individual file size that users can upload to modules that support file uploads. Restricts the upload limit from within Sugar without affecting any other applications that may be running on your server. This limit can be easily adjusted in Sugar via Admin > System Settings but is only useful if it is set to a size smaller than the php.ini limits. For more information, refer to the Uploads documentation.TypeInteger : Filesize in bytesVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['upload_maxsize'] = 40000000;upload_wrapper_class
DescriptionThe name of the class used as upload wrapper.TypeString : Upload wrapper classVersions6.7.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueUploadStreamOverride Example$sugar_config['upload_wrapper_class'] = 'SugarUploadS3';use_common_ml_dir
DescriptionA security control that allows you to restrict Module Loader to read modules from a specific directory on the server and disable the ability to upload new modules into the Module Loader. To specify a new directory you will need to populate the config parameter 'common_ml_dir'.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['use_common_ml_dir'] = true;use_php_code_json
DescriptionDetermines if the environment has a valid version of PHP-JSON. This should be determined by the function returnPhpJsonStatus() and shouldn't be overridden.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['use_php_code_json'] = true;use_real_names


DescriptionDisplay users' full names instead of their User Names in assignment fields.TypeBooleanRange of valuestrue and falseVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['use_real_names'] = true;use_sprites
DescriptionA sprite is a two-dimensional image or animation that is integrated into a larger scene. This parameter is used to disable sprites. This is set to true by default (if you have GD libraries installed).TypeBooleanRange of valuestrue and falseVersions6.4.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['use_sprites'] = false;validation
DescriptionAn array that defines settings for user input validation behaviors.TypeArrayVersions7.7.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['validation'] = array();validation.compat_mode
DescriptionDetermines compatibility mode for superglobals in the input validation framework. When enabled, setting, unsetting, and modifying $_GET, $_POST, or $_REQUEST values through PHP code is supported. Using PHP code to manipulate superglobals is discouraged. User input parameters should be considered read-only. As a transition period, this is currently allowed out-of-box, but may change in a future release. It is highly recommended for developers to verify their customizations work with this parameter set to false in preparation for the 7.9 release.TypeBooleanRange of valuestrue and falseVersions7.7.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value7.7.x: true7.8.x: true7.9.x: falseOverride Example$sugar_config['validation']['compat_mode'] = false;validation.soft_fail


DescriptionDetermines whether soft failure mode for the input validation framework is enabled. When this mode is enabled, any input validation violations will only be reported as a warning in the sugarcrm.log without having any negative impact on the request. When disabled, violations are reported as fatal in the sugarcrm.log and actual exceptions are being thrown resulting in an HTTP 500 response.
It is highly recommended for developers to verify their customizations work with this parameter set to false in preparation for the 8.0 release.TypeBooleanRange of valuestrue and falseVersions7.7.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value7.7.x: true7.8.x: true7.9.x: true8.0.x: falseOverride Example$sugar_config['validation']['soft_fail'] = false;vcal_time
DescriptionUsed to determine the number of months in advance of the current date that the Free/Busy information for calls and meetings will be published. To turn Free/Busy publishing off, set this variable to '0'. The minimum is 1 month; the maximum is 12 months.TypeString : MonthsRange of values'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', and '12'Versions5.2.0.c+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value2Override Example$sugar_config['vcal_time'] = '5';verify_client_ip
DescriptionWhether or not to verify the client IP. Setting this to true will enable the system checking to see if the user is accessing Sugar from the IP address of their last page load.


Note: This default value must be set to "false" in order to use Sugar Connect and Sugar Integrate.TypeBooleanRange of valuestrue and falseVersions10.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['verify_client_ip'] = true;web_logic_hook_timeout
DescriptionTimeout for requests to web logic hooks. Any requests that run longer than the set limit will fail and trigger an error in the log.TypeInteger : secondsVersions11.1.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['web_logic_hook_timeout'] = 2;wl_list_max_entries_per_page
DescriptionThe number of records to be shown per page on the listview of the mobile browser.TypeInteger : Number of records to displayVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['wl_list_max_entries_per_page'] = 10;wl_list_max_entries_per_subpanel
DescriptionDetermines the number of records shown in the subpanels on the DetailView of the mobile browser.TypeInteger : RecordsVersions5.2.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value3Override Example$sugar_config['wl_list_max_entries_per_subpanel'] = 3;xhprof_config
DescriptionConfiguration settings for xhprof. More information on xhprof can be found at http://pecl.php.net/package/xhprof.TypeArrayVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['xhprof_config'] = array();xhprof_config.enable


DescriptionEnables the xhprof profiler.TypeBooleanRange of valuestrue and falseVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuefalseOverride Example$sugar_config['xhprof_config']['enable'] = true;xhprof_config.filter_wt
DescriptionThe wall time. Values are specified in milliseconds.TypeInteger : Wall time in millisecondsVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value0Override Example$sugar_config['xhprof_config']['filter_wt'] = 2;xhprof_config.flags
DescriptionThe flags for xhprof profiler.TypeString : xhprof flagsVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['xhprof_config']['flags'] = XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY;xhprof_config.ignored_functions
DescriptionAn array of function names to ignore from the profile.TypeArray : Function namesVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['xhprof_config']['ignored_functions'] = array("function_name");xhprof_config.log_to
DescriptionThe path to log the xhprof profiler output to.TypeString : Directory pathVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellOverride Example$sugar_config['xhprof_config']['log_to'] = '{instance server path}/cache/xhprof';xhprof_config.manager
DescriptionThe xhprof manager class to use. Prior to 7.7, specifying values xhprof_config.save_to, xhprof_config.mongodb_uri, xhprof_config.mongodb_db, xhprof_config.mongodb_collection, xhprof_config.mongodb_options, and


xhprof_config.filter_wt will need to have set xhprof_config.manager set to 'SugarXHprofPerformance'. As of 7.7, setting xhprof_config.manager is not longer required.
If you want to customize SugarXHprof, you can create the folder ./custom/include/SugarXHprof/ and create a file with your custom class class name. The custom class will need to extend SugarXHprof. If a custom class doesn't exist or hasn't been specified, SugarXHprof will be used.TypeString : ClassVersions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueSugarXHprofOverride Example$sugar_config['xhprof_config']['manager'] = 'CustomSugarXHprof';xhprof_config.memory_limit
DescriptionThe memory limit to set while saving profile data to storage.TypeString : Memory UsageVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value2048MOverride Example$sugar_config['xhprof_config']['memory_limit'] = '1024M';xhprof_config.mongodb_collection
DescriptionThe name of the mongo db collections.TypeString : Mongo collection nameVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueresultsOverride Example$sugar_config['xhprof_config']['mongodb_db'] = 'results_new';xhprof_config.mongodb_db
DescriptionThe name of the mongo database.TypeString : Database nameVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuexhprofOverride Example$sugar_config['xhprof_config']['mongodb_db'] = 'xhprof2';xhprof_config.mongodb_options


DescriptionOptions for mongo db connection. The list of construct options can be found at: http://php.net/manual/en/mongoclient.construct.php#mongo.mongoclient.construct.parametersTypeArray : Mongo db optionsVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValueresultsOverride Example$sugar_config['xhprof_config']['mongodb_options'] = array();xhprof_config.mongodb_uri
DescriptionThe mongo server URL.TypeString : URLVersions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Valuemongodb://localhost:27017Override Example$sugar_config['xhprof_config']['mongodb_uri'] = 'mongodb://localhost:27018';xhprof_config.sample_rate
DescriptionThe sample rate of the xhprof profiler. 1/{specified value} requests are profiled. To sample all requests, set this value to 1.TypeInteger : Sample Rate (1/{value})Versions6.5.10+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault Value10Override Example$sugar_config['xhprof_config']['sample_rate'] = 1;xhprof_config.save_to
DescriptionThe place to save xhprof data. If set to 'mongodb', the data is stored in the mongo database.TypeString : Save LocationRange of values'file' and 'mongodb'Versions7.6.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuemongodbOverride Example$sugar_config['xhprof_config']['save_to'] = 'mongodb';xhprof_config.track_elastic


DescriptionWhether or not to track elastic data.TypeBooleanRange of valuestrue or falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['xhprof_config']['track_elastic'] = false;xhprof_config.track_elastic_backtrace
DescriptionWhether or not to store the elastic backtrace data.TypeBooleanRange of valuestrue or falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['xhprof_config']['track_elastic_backtrace'] = false;xhprof_config.track_sql
DescriptionWhether or not to track SQL queries.TypeBooleanRange of valuestrue or falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['xhprof_config']['track_sql'] = false;xhprof_config.track_sql_backtrace
DescriptionWhether or not to store the SQL backtrace data.TypeBooleanRange of valuestrue or falseVersions7.7.0.0+ProductsProfessional, Enterprise, Ultimate, Serve, SellDefault ValuetrueOverride Example$sugar_config['xhprof_config']['track_sql_backtrace'] = false;
  	Last modified: 2023-05-25 16:37:57


Validation Constraints
Overview
This article will cover how to add validation constraints toÂ your customÂ code.
Constraints
Validation constraintsÂ allow developers to validate user input
Symfony Validation Constraints
TheÂ Symfony's Validation library, located in ./vendor/symfony/validator/,Â contains many open source constraints. You can find the full list of constraints documented in Symphony'sÂ Validation Constraints. They are listed below for your reference.
Basic Constraints
NotBlank
Blank
NotNull
IsNull
IsTrue
IsFalse
Type
String Constraints
Email
Length
Url
Regex
Ip
Uuid
Number Constraints
Range
Comparison Constraints
EqualTo
NotEqualTo
IdenticalTo
NotIdenticalTo
LessThan
LessThanOrEqual
GreaterThan
GreaterThanOrEqual
Date Constraints
Date
DateTime
Time
Collection Constraints
Choice
Collection
Count
UniqueEntity
Language
Locale
Country
File Constraints
File
Image
Financial and other Number Constraints
Bic
CardScheme
Currency
Luhn
Iban
Isbn
Issn
Other Constraints
Callback
Expression
All
UserPassword
Valid
Sugar Constraints
Sugar containsÂ its ownÂ set ofÂ validation constraints. These constraints extendÂ from Symfony's validation constraintsÂ and are located in ./src/Security/Validator/Constraints ofÂ your Sugar installation.
Bean/ModuleName
Bean/ModuleNameValidator
ComponentName
ComponentNameValidator
Delimited
DelimitedValidator
DropdownList
DropdownListValidator
File
FileValidator
Guid
GuidValidator
InputParameters
InputParametersValidator
JSON
JSONValidator
Language
LanguageValidator
LegacyCleanString
LegacyCleanStringValidator
Mvc/ModuleName
Mvc/ModuleNameValidator
PhpSerialized
PhpSerializedValidator
Sql/OrderBy
Sql/OrderByValidator
Sql/OrderDirection
Sql/OrderDirectionValidator
SugarLogic/FunctionName
SugarLogic/FunctionNameValidator


Sql/OrderDirectionValidator
SugarLogic/FunctionName
SugarLogic/FunctionNameValidator
Custom Constraints
If you find that the existing constraints do not meet your needs,Â you can also create your own. These constraints exist underÂ ./custom/src/Security/Validator/Constraints/.Â The following section will outline the details.Â The example below will demonstrate how to create a phone number validation constraint.Â
The constraint file will contain your validations error message.
./custom/src/Security/Validator/Constraints/Phone.php
<?php
namespace Sugarcrm\Sugarcrm\custom\Security\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
 *
 * @see PhoneValidator
 *
 */
class Phone extends Constraint
{
    public $message = 'Phone number violation: %msg%';
}
The validator file will contain the logic to determine whether the value meets the requirements.
./custom/src/Security/Validator/Constraints/PhoneValidator.php
<?php
namespace Sugarcrm\Sugarcrm\custom\Security\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
/**
 *
 * Phone validator
 *
 */
class PhoneValidator extends ConstraintValidator
{
    /*
     * Phone Pattern Examples;
     * +1 12 3456789
     * +1.12.3456789
     */
    const PHONE_PATTERN = '/^([+]?\d+(?:[ \.]\d+)*)$/';
    /**
     * {@inheritdoc}
     */
    public function validate($value, Constraint $constraint)
    {
        if (!$constraint instanceof Phone) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Phone');
        }


throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Phone');
        }
        if (null === $value || '' === $value) {
            return;
        }
        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
            throw new UnexpectedTypeException($value, 'string');
        }
        $value = (string) $value;
        // check for allowed characters
        if (!preg_match(self::PHONE_PATTERN, $value)) {
            $this->context->buildViolation($constraint->message)
                ->setParameter('%msg%', 'invalid format')
                ->setInvalidValue($value)
                ->addViolation();
            return;
        }
    }
}
Once the files are in place,Â navigate to Admin > Repairs and run a Quick Repair and Rebuild. Once completed, your constraint will be ready for use.
Using Constraints in API End Points
In this section, we will create a custom endpoint and triggerÂ the custom phone constraint we created above.Â TheÂ code below will create aÂ RESTÂ API endpoint path ofÂ /phoneCheck:
./custom/clients/base/api/MyEndpointsApi.php
<?php
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
use Sugarcrm\Sugarcrm\Security\Validator\ConstraintBuilder;
use Sugarcrm\Sugarcrm\Security\Validator\Validator;
class MyEndpointsApi extends SugarApi
{
    public function registerApiRest()
    {
        return array(
            //POST
            'MyEndpointsApi' => array(
                //request type
                'reqType' => 'POST',
                //endpoint path
                'path' => array('phoneCheck'),


//endpoint path
                'path' => array('phoneCheck'),
                //endpoint variables
                'pathVars' => array(''),
                //method to call
                'method' => 'phoneCheck',                //minimum api version                'minVersion' => 10,
                //short help string to be displayed in the help documentation
                'shortHelp' => 'An example of a POST endpoint to validate phone numbers',
                //long help to be displayed in the help documentation
                'longHelp' => 'custom/clients/base/api/help/MyEndPoint_phoneCheck_help.html',
            ),
        );
    }
    /**
     * Method to be used for my MyEndpointsApi/phoneCheck endpoint
     */
    public function phoneCheck($api, $args)
    {
        $validator = Validator::getService();
        /**
         * Validating Phone Number
         */
        $phoneContraintBuilder = new ConstraintBuilder();
        $phoneConstraints = $phoneContraintBuilder->build(
            array(
                'Assert\Phone',
            )
        );
        $errors = $validator->validate($args['phone'], $phoneConstraints);
        if (count($errors) > 0) {
            /*
             * Uses a __toString method on the $errors variable which is a
             * ConstraintViolationList object. This gives us a nice string
             * for debugging.
             */
            $errorsString = (string) $errors;
            // include/api/SugarApiException.php
            throw new SugarApiExceptionInvalidParameter($errorsString);
        }
        //custom logic
        return $args;
    }
}
After creating the endpoint, navigate to Admin > Repairs and run a Quick Repair and Rebuild. The API will then be ready to use.


Valid Payload - POST to /phoneCheck
The example below demonstrates a valid phone number post the /phoneCheckÂ endpoint.
{    phone: "+1.23.456.789"}
Result
{    phone: "+1.23.456.789"}
Invalid Payload - POST to /phoneCheck
The example below demonstrates an invalid phone number post theÂ /phoneCheckÂ endpoint.
{    phone: "Invalid+1.23.456.789"}
Result
{    "error":"invalid_parameter",    "error_message":"Invalid+1.23.456.789:\n    Phone number violation: invalid format\n"}
  	Last modified: 2023-02-03 21:04:03


Sugar Logic
Overview
Sugar Logic, a feature in all Sugar products, enables custom business logic that is easy to create, manage, and reuse on both the server and client.
Sugar Logic is made up of multiple components that build on each other and is extensible at every step. The base component is the Sugar Formula Engine, which parses and evaluates human-readable formulas. Dependencies are units made up of triggers and actions that can express custom business logic. Each dependency defines a list of actions to be performed depending on the outcome of a trigger formula.
Terminology
Formula : An expression that conforms to the Formula Engine syntax, consisting of nested functions and field variables
Function : A method that can be called in a formula
Trigger : A formula that evaluates to either true or false when a field in the equation is updated or when a record is retrieved/saved
Action : A method that modifies the current record or layout in some way
Dependency : A complete logical unit that includes a trigger and one or more actions
Sugar Formula Engine
Formulas
The fundamental object is called a formula. A formula can be evaluated for a given record using the Sugar Logic parser.
Some example formulas are:
Basic addition:
add(1, 2)
Boolean values:
not(equal($billing_state, "CA"))
Calculation:
multiply(number($employees), $seat_cost, 0.0833)
Types
Sugar Logic has several fundamental types: number, string, boolean, and enum (lists). Functions may take in any of these types or combinations thereof and return as output one of these types. Fields may also often have their value set to only a certain type.
Number Type
Number types essentially represent any real number (which includes positive, negative, and decimal numbers). They can be plainly typed as input to any function. For example, the operation (10 + 10 + (15 - 5)) can be performed as follows:


add(10, 10, subtract(15, 5))
String Type
A string type is very much like a string in most programming languages. However, it can only be declared within double quotes. For example, consider this function, which returns the length of the input string:
strlen("Hello World")
The function would appropriately return the value 11.
Boolean Type
A boolean type is simple. It can be one of two values: "true" or "false". This type mainly acts as a flag that indicates whether a condition has been met or not. For example, this function contains takes two strings as input and returns "true" if the first string contains the second string, or "false" otherwise:
and(contains("Hello World", "llo Wo"), true)
The function would appropriately return the value "true".
Enum Type (list)
An enum type is a collection of items. The items do not need to all be of the same type, they can be varied. An enum can be declared using the enum function as follows:
enum("hello world!", false, add(10, 15))
Alternatively, the createList() function (an alias to enum) can be used to create enums in a formula.
createList("hello world!", false, add(10, 15))
This function would appropriately return an enum type containing "hello world!", false, and 25 as its elements.
Link Type (relationship)
A link represents one side of a relationship and is used to access related records. For example, the accounts link field of Contacts is used to access the account_type field of the account related to a contact:
related($accounts, "account_type")
For most of the out-of-the-box relationships, links are named with the name of the related module, in lower case.


Follow these steps to find the name of the link fields for relationships that do not follow the convention above:
Open the vardef file for the module you are working on: ./cache/modules/{module}/{module}vardefs.php
Find the link field that matches the relationship you are looking for.
Functions
Functions are methods to be used in formulas. Each function has a function name, a parameter count, a parameter type requirement, and returns a value. Some functions such as add() can take any number of parameters. For example: add(1), add(1, 2), and add(1, 2, 3) are all valid formulas. Functions are designed to produce the same result whether executed on the server or client.
Triggers
A trigger is an object that listens for changes in field values and, after a change occurs, triggers the associated actions in a dependency.
Actions
Actions are functions thatÂ modify a target in some way and are fired when the trigger is TRUE. Most Actions require at least two parameters: a target and a formula. For example, a style action will change the style of a field based on a passed-in string formula. A value action will update a value of a field by evaluating a passed in formula.
notActions
notActions are functions thatÂ modify a target in some way and are fired when the trigger is FALSE. notActions are optional and if they are not defined then nothing will fire when the trigger is FALSE.Â  Most notActions require at least two parameters: a target and a formula. For example, a style action will change the style of a field based on a passed-in string formula. A value action will update a value of a field by evaluating a passed in formula.
Dependencies


Dependencies
A Dependency describes a set of rules based on a trigger and a set of actions. Examples include a field whose properties must be updated dynamically or a panel which must be hidden when a drop down value is not selected. When a Dependency is triggered it will appropriately carry out the action it is designed to. A basic Dependency is when a field's value is dependent on the result of evaluating a Expression. For example, consider a page with five fields with It's "a", "b", "c", "d", and "sum". A generic Dependency can be created between "sum" and the other four fields by using an Expression that links them together, in this case an add Expression. So we can define the Expression in this manner: 'add($a, $b, $c, $d)' where each field id is prefixed with a dollar ($) sign so that the value of the field is dynamically replaced at the time of the execution of the Expression.
An example of a more customized Dependency is when the field's style must be somehow updated to a certain value. For example, the DIV with id "temp" must be colored blue. In this case we need to change the background-color property of "temp". So we define a StyleAction in this case and pass it the field id and the style change that needs to be performed and when the StyleAction is triggered, it will change the style of the object as we have specified.
Sugar Logic Based Features
Calculated Fields
Fields with calculated values can now be created from within Studio and Module Builder. The values are calculated based on Sugar Logic formulas. These formulas are used to create a new dependency that are executed on the client side in edit views and the server side on save. The formulas are saved in the varies or vardef extensions and can be created and edited directly. For example, the metadata for a simple calculated commission field in opportunities might look like:
'commission_c' => array(


'commission_c' => array(
    'name' => 'commission_c',
    'type' => 'currency',
    'calculated' => true,
    'formula' => 'multiply($amount, 0.1)',
    //enforced causes the field to appear read-only on the layout
    'enforced' => true
),
Dependent fields
A dependent field will only appear on a layout when the associated formula evaluates to the Boolean value true. Currently these cannot be created through Studio and must be enabled manually with a custom vardef or vardef extension. The "dependency" property contains the expression that defines when this field should be visible. An example field that only appears when an account has an annual revenue greater than one million.
'dep_field'=> array(
    'name' => 'dep_field',
    'type' => 'varchar',
    'dependency' => 'greaterThan($annual_revenue, 1000000)',
),
Dependent dropdowns
Dependent dropdowns are dropdowns for which options change when the selected value in a trigger dropdown changes. The metadata is defined in the vardefs and contains two major components, a "trigger" id which is the name of the trigger dropdown field and a 'visibility grid' that defines the set of options available for each key in the trigger dropdown. For example, you could define a sub-industry field in accounts whose available values depend on the industry field.
'sub_industry_c' => array(
    'name' => 'sub_industry_c',
    'type' => 'enum',
    'options' => 'sub_industry_dom',
    'visibility_grid'=> array(
        'trigger' => 'industry',
        'values' => array(
            'Education' => array(
                'primary',
                'secondary',
                'college'
            ),


'primary',
                'secondary',
                'college'
            ),
            'Engineering' => array(
                'mechanical',
                'electrical',
                'software'
            ),
        ),
    ),
),
Clearing the Sugar Logic Cache
The ./updatecache.php script traverses the Expression directory for every file that ends with "Expression.php" (ignoring a small list of excepted files) and constructs both a PHP and a JavaScript functions cache file which resides in ./cache/Expressions/functions_cache.js and ./cache/Expressions/functionmap.php. If you create your custom expressions, you will need to rebuild the sugar logic functions by navigating to:
Admin > Repair > Rebuild Sugar Logic Functions
TopicsDependency ActionsThe following sections outline the available SugarLogic dependency actions.Extending Sugar LogicHow to write custom Sugar Logic functions.Using Sugar Logic DirectlyHow to use Sugar Logic
  	Last modified: 2023-02-03 21:04:03


Dependency Actions
Overview
The following sections outline the available SugarLogic dependency actions.
Dependency Parameters
Dependency definitions will generally containÂ most, if not all, of the parameters displayed in the table below. The following sections will outline each dependencyÂ action as well as dependency specific parameters.
Parameter
Type
Description
hooks
Â Array
Â The views to execute the trigger on. Possible values are:Â "edit", "view", "save" and "all". Â  If you include 'save' orÂ 'all' then SugarCRM will try to save the calculated value to the database. Â So if your dependency is display only thenÂ only include the views that it will show up on.
trigger
Â String
Â Optional. The trigger for the dependency. Defaults to 'true'.
triggerFields
Â Array
Â The list of fields to watch for change events. When changed, the trigger expressions will be recalculated.
onload
Â Boolean
Â Whether or not to trigger the dependencies when the page is loaded.
actions
Â Array
Â The list of dependencies to execute when the trigger expression is true.
notActions
Â Array
Â The list of dependencies to execute when the trigger expression is false.
Â


Â The list of dependencies to execute when the trigger expression is false.
Â
TopicsReadOnlyThe SugarLogic ReadOnly action, located in ./include/Expressions/Actions/ReadOnlyAction.php, is used to determine if a field is editable or not based on a formula.SetOptionsThe SugarLogic SetOptions action, located in ./include/Expressions/Actions/SetOptionsAction.php, is used to set the options list of a dropdown field based on a formula.SetPanelVisibilityThe SugarLogic SetPanelVisibility action, defined in ./include/Expressions/Actions/PanelVisibilityAction.php, is used to determine the visibility of a record view panel based on a formula.SetRequiredThe SugarLogic SetRequired action, located in ./include/Expressions/Actions/SetRequiredAction.php, is used to determine if a field is required.SetValueThe SugarLogic SetValue action, located in ./include/Expressions/Actions/SetValueAction.php, is used to set the value of a field based on a formula.SetVisibilityThe SugarLogic SetVisibility action, located in ./include/Expressions/Actions/VisibilityAction.php , is used to determine the visibility logic of a field based on a formula.
  	Last modified: 2023-02-03 21:04:03


SetValue
Overview
The SugarLogicÂ SetValue action, located in ./include/Expressions/Actions/SetValueAction.php, is used to set the value of a field based on a formula.
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
SetValue Parameters
Parameter
Type
Description
target
String
The name of the field to target for visibility.
value
String
SugarLogic formula used to get the value for the target field.
For more information on the various parameters in the dependency definitions, please refer to the dependency actions documentation.
Examples
The follow sections outline the various ways this dependency can be implemented.
Dependency Extensions
For our example, we will create a dependency on the Leads module that will display the number of activities related to a Lead. Â Activities are composed of calls, meetings, tasks, notes, and emails.Â AnÂ example extension definition is shown below:
./custom/Extension/modules/<module>/Ext/Dependencies/custom_phone_alternate.php
<?php
$dependencies['Leads']['activity_count_dep'] = array(
    'hooks' => array("edit", "view"), //not including save so that the value isn't stored in the DB
    'trigger' => 'true', //Optional, the trigger for the dependency. Defaults to 'true'.
    'onload' => true, //Whether or not to trigger the dependencies when the page is loaded
    'actions' => array(
        array(
            'name' => 'SetValue',
            'params' => array(


'name' => 'SetValue',
            'params' => array(
                'target' => 'activity_count_c',
                'value' => 'add(
                    count($notes),
                    count($calls),
                    count($emails),
                    count($meetings),
                    count($tasks)
                )'
            )
        )
    )
);
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Cases' vs. 'Case') and that the name of the dependency, "activity_count_dep" in this example,Â isÂ unique.
Chaining Dependencies
You can also add as many actions as you need to the array.Â In the example below, we want to display our count value but prevent users from being able to edit the value.Â AnÂ example extension definition is shown below:
<?php
$dependencies['Leads']['number_of_cases_dep'] = array(
    'hooks' => array("edit", "view"), //not including save so that the value isn't stored in the DB
    'trigger' => 'true', //Optional, the trigger for the dependency. Defaults to 'true'.
    //'triggerFields' => array('status'), //unneeded for this example as its not field triggered
    'onload' => true,
    'actions' => array(
        array(
            'name' => 'SetValue',
            'params' => array(
                'target' => 'activity_count_c',
                'value' => 'add(
                    count($notes),
                    count($calls),
                    count($emails),
                    count($meetings),
                    count($tasks)


count($emails),
                    count($meetings),
                    count($tasks)
                )'
            )
        ),
        array(
            'name' => 'ReadOnly',
            'params' => array(
                'target' => 'activity_count_c',
                'value' => 'true',  //Set to true instead of a formula because its always read-only
            ),
        )
    )
);
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Cases' vs. 'Case') and that the name of the dependency, "number_of_cases_dep" in this example,Â isÂ unique.
Dependencies in Field Definitions
Unlike several of the other dependencies, SetValue is built into Studio.Â  So this dependency can be set as a custom vardef value or in the vardefs file of aÂ custom module.Â  If you wanted to add this dependency to an existing field then you can create a vardef extensionÂ such asÂ ./custom/Extension/modules/<module>/Ext/Vardefs/.Â AnÂ example extension definition is shown below:
./custom/Extension/modules/Accounts/Ext/Vardefs/activity_count_c.php
<?php
$dictionary['Lead']['fields']['activity_count_c']['options'] = 'numeric_range_search_dom';
$dictionary['Lead']['fields']['activity_count_2_c']['calculated'] = 'true';
$dictionary['Lead']['fields']['activity_count_2_c']['formula'] = 'add(
    count($calls),
    count($emails),
    count($meetings),
    count($notes),
    count($tasks)
)';


count($notes),
    count($tasks)
)';
$dictionary['Lead']['fields']['activity_count_2_c']['enforced'] = 'true';
$dictionary['Lead']['fields']['activity_count_2_c']['enable_range_search'] = '1';
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Â
  	Last modified: 2023-02-03 21:04:03


ReadOnly
Overview
The SugarLogic Â ReadOnlyÂ action, located in ./include/Expressions/Actions/ReadOnlyAction.php, is used to determineÂ if a field is editable or not based on a formula.
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third-partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
ReadOnly Parameters
Parameter
Type
Description
target
String
The name of the field to make read only.
value
String
This parameter can accept a boolean formula orÂ trueÂ andÂ falseÂ values.Â  Normally you would put aSugarLogic formula here to set the boolean.
For more information on the various parameters in theÂ dependency definitions, please refer to the dependency actionsÂ documentation.
Example
For our example, we will create a dependency on the Accounts module that makes the name field read-onlyÂ when the lock_record_c field has been checked.Â The first step is to create theÂ Â lock_record_cÂ checkbox field in Studio and add it to your Record View layout. When this checkbox is checked, we will make the name field read-only. Our example extension definition is shown below:Â
./custom/Extension/modules/<module>/Ext/Dependencies/custom_name_read_only.php
<?php
$dependencies['Accounts']['readonly_fields'] = array(
    'hooks' => array("edit"),
    'trigger' => 'true',
    //Optional, the trigger for the dependency. Defaults to 'true'.
    'triggerFields' => array('lock_record_c'),
    'onload' => true,


'onload' => true,
    //Actions is a list of actions to fire when the trigger is true
    // You could list multiple fields here each in their own array under 'actions'
    'actions' => array(
        array(
            'name' => 'ReadOnly',
            //The parameters passed in will depend on the action type set in 'name'
            'params' => array(
                'target' => 'name',
                'value' => 'equal($lock_record_c,true)',
            ),
        ),
    ),
);
Once you have all the files in place you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Accounts' vs. 'Account') and that the name of the dependency, "readonly_fields" in this example,Â isÂ unique.
Considerations
In some scenarios, you may want a specific field to always be read-only. To accomplish this, you can modify theÂ 'value'Â attribute to always be "true". Given the above example, you wouldÂ modify:
'value' => 'equal($lock_record_c,true)',
to be:
'value' => 'true',
  	Last modified: 2023-02-03 21:04:03


SetRequired
Overview
The SugarLogic SetRequired action, located in ./include/Expressions/Actions/SetRequiredAction.php, is used to determineÂ if a field is required.Â
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third-partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
SetRequired Parameters
Parameter
Type
Description
target
String
The name of the field to make required.
label
String
id of label element for this field
value
String
Formula used to determine if the field should be required.
For more information on the various parameters in the dependency definitions, please refer to the dependency actions documentation.
Example
For our example, we will create a dependency on the Cases module that will mark the resolution field as required when the status field is set to "Closed".Â Our example extension definition is shown below:
./custom/Extension/modules/<module>/Ext/Dependencies/required_resolution_dep.php
<?php
$dependencies['Cases']['required_resolution_dep'] = array(
    'hooks' => array("edit"),
    'trigger' => 'true',
    'triggerFields' => array('status'),
    'onload' => true,
    //Actions is a list of actions to fire when the trigger is true
    'actions' => array(
        array(
            'name' => 'SetRequired',
            //The parameters passed in will depend on the action type set in 'name'
            'params' => array(
                'target' => 'resolution',
                'label' => 'resolution_label',


'target' => 'resolution',
                'label' => 'resolution_label',
                'value' => 'equal($status, "Closed")',
            ),
        ),
    ),
);
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Cases' vs. 'Case') and that the name of the dependency, "required_resolution_dep" in this example,Â isÂ unique.
  	Last modified: 2023-02-03 21:04:03


SetOptions
Overview
The SugarLogicÂ SetOptions action, located in ./include/Expressions/Actions/SetOptionsAction.php, is used to set the options list of a dropdown field based on a formula.
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
Setoptions Parameters
Parameter
Type
Description
target
String
The name of the dropdown field that you want to change the option list for
keys
String
A formula used to get the option list keys for the target field or a list name from which keys will be extracted.
labels
String
A formula used to get the option list labels for the target field or a list name from which labels will be extracted.
For more information on the various parameters in the dependency definitions, please refer to the dependency actions documentation.
Examples
The following sections outline the various ways this dependency can be implemented.
Using an Existing DropDown List
You can also set the options list to any current options list already in the systemÂ  For example if you wanted to have the industry dropdown in Accounts show the 'bug_type_dom' list from Bugs you could do this
<?php
$dependencies['Leads']['setoptions_industry'] = array(
   'hooks' => array("edit","save"),
   'trigger' => 'true',
   'triggerFields' => array('industry'),
   'onload' => true,
   'actions' => array(
     array(
       'name' => 'SetOptions',
       'params' => array(


'name' => 'SetOptions',
       'params' => array(
         'target' => 'industry',
         'keys' => 'getDropdownKeySet("bug_type_dom")',
         'labels' => 'getDropdownValueSet("bug_type_dom")'
       ),
     ),
   ),
);
This would grab the keys and label from the 'bug_type_dom' using the getDropdownKeySet() and getDropdownValueSet() JavaScript functions and display them instead of the normal list.Â
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Accounts' vs. 'Account') and that the name of the dependency, "setoptions_industry" in this example,Â isÂ unique.
Complex Dynamic Lists
For our first example, we will change a dropdown called fruits_c to include only fruits that areÂ in season.Â  This could be done with a dependent dropdown but that would require the user to pick the proper season.Â  With this, we can have a function that returns only fruit that is in season right now.Â  I added the dropdown fruits_c to Leads and created a new list for it that looks like this
$app_list_strings['fruits_list']=array (
	'Apples' => 'Apples',
	'Strawberries' => 'Strawberries',
	'Mangos' => 'Mangos',
	'Pineapples' => 'Pineapples',
	'Blackberries' => 'BlackBerries',
	'BlueBerries' => 'BlueBerries',
);
To keep it simple I made the labels and the keys the same.


);
To keep it simple I made the labels and the keys the same.
Then I extended SugarLogic as outlined in Extending SugarLogic and made a new functionÂ called fruitInSeason() that returns a string reflecting what fruit is in season right now. Â To work for the createList() function it would return a list like "Apples","Mangos","BlueBerries".
./custom/Extension/modules/<module>/Ext/Dependencies/custom_fruit_in_season.php
<?php
$dependencies['Leads']['setoptions_fruit'] = array(
   'hooks' => array("edit","save"),
   'trigger' => 'true',
   'triggerFields' => array('fruits_c'),
   'onload' => true,
   'actions' => array(
      array(
        'name' => 'SetOptions',
        'params' => array(
           'target' => 'fruits_c',
           'keys' => "createList(fruitInSeason())",
           'labels' => "createList(fruitInSeason())"
        ),
      ),
    ),
);
The createList() function is a JavaScript function from Sidecar.Â  It requires a comma delimited quote enclosed list of options.Â
We only want this to affect EditViews and Saves, not normal record views since they need to be able to display all fruits and not a truncated list of them.Â  So we make the 'hooks' array
'hooks' => array("edit","save"),
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.


Note: It is important that the module name is plural ('Leads' vs. 'Lead') and that the name of the dependency, "setoptions_fruit" in this example,Â isÂ unique.
  	Last modified: 2023-02-03 21:04:03


SetVisibility
Overview
The SugarLogicÂ SetVisibilityÂ action, located inÂ ./include/Expressions/Actions/VisibilityAction.phpÂ , is used toÂ determineÂ the visibility logic of a field based on a formula.
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
SetVisibility Parameters
Parameter
Type
Description
target
String
The name of the field to target for visibility.
value
String
This parameter can accept a boolean formula orÂ trueÂ andÂ falseÂ values.Â  Normally you would put aSugarLogic formula here to set the boolean.
For more information on the various parameters in the dependency definitions, please refer to the dependency actions documentation.
Examples
The follow sections outline the various ways this dependency can be implemented.Â
SetVisibility Dependency Extensions
For our example, we will create a dependency on the Accounts module that shows the phone_alternate field when the phone_office field has been populated. An example is shown below.
./custom/Extension/modules/<module>/Ext/Dependencies/custom_phone_alternate.php
<?php
$dependencies['Accounts']['phone_alternate_hide'] = array(
        'hooks' => array("edit"),
        'triggerFields' => array('phone_office'),
        'onload' => true,
        //Actions is a list of actions to fire when the trigger is true
        'actions' => array(
            array(
                'name' => 'SetVisibility',
                'params' => array(


'name' => 'SetVisibility',
                'params' => array(
                    'target' => 'phone_alternate',
                    'value' => 'not(equal($phone_office,""))',
                ),
            ),
        ),
    );
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Accounts' vs. 'Account') and that the name of the dependency, "phone_alternate_hide" in this example,Â isÂ unique.Â
Visibility Dependencies in Field Definitions
Unlike several of the other dependencies, SetVisibility is built into Studio.Â  So this dependency can be set as a custom vardef value or in the varefs file for a new module. If you wanted to add this dependency to an existing field then you could add a file to ./custom/Extension/modules/<module>/Ext/Vardefs/. An example is shown below.
To accomplish this, we will create an extension in ./custom/Extension/modules/Accounts/Ext/Vardefs/.Â
./custom/Extension/modules/Accounts/Ext/Vardefs/phone_alternate.php
<?php
$dictionary['Account']['fields']['phone_alternate']['dependency']='not(equal($phone_office,""))
Next, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild. Once that is done, you can enter a value into phone_office and the phone_alternate field will show up once you tab out of the phone_office field. If you were coding a customÂ module with new fields, then you would just include it in the modules vardefs.php fileÂ as shown below
<?php
$dictionary['myModule'] = array(
    ...


<?php
$dictionary['myModule'] = array(
    ...
    'fields' => array(
        ...
        'phone_alternate' => array(
	    'name' => 'phone_alternate',
	    'vname' => 'LBL_PHONE_ALTERNATE',
	    'type' => 'varchar',
	    'len' => 10,
	    'dependency'=> 'not(equal($phone_office,""))',
	    'comment' => 'Other Phone Number',
	    'merge_filter' => 'enabled',
        ),
        ...
    )
    ...
);
  	Last modified: 2023-02-03 21:04:03


SetPanelVisibility
Overview
The SugarLogic SetPanelVisibilityÂ action,Â defined in ./include/Expressions/Actions/PanelVisibilityAction.php, is used to determineÂ the visibility of a record view panel based on a formula.Â
Implementation
While the dependency metadata for your module can be defined inÂ ./modules/<module>/metadata/dependencydefs.php and Â ./custom/modules/<module>/metadata/dependencydef.php, it is recommended to use the extension framework when customizing stock modules to prevent third-partyÂ plugins from conflicting with your customizations. The following sectionÂ will demonstrate how to implement a read-only dependency.
SetPanelVisibility Parameters
Parameter
Type
Description
target
String
The id of the panel to hide
value
String
Formula used to determine if the panel should be visible.
For more information on the various parameters in the dependency definitions, please refer to the dependency actions documentation.
Example
For our example, we will create a dependency on the Cases module that will hide a specificÂ panelÂ if the status field onÂ a case is set to "Closed". Our example extension definition is shown below:Â
./custom/Extension/modules/<module>/Ext/Dependencies/hide_panel_2_dep.php
<?php
$dependencies['Cases']['panel_2_visibility'] = array(
    'hooks' => array("edit","view"),
    'trigger' => 'equal($status, "Closed")',
    'triggerFields' => array('status'),
    'onload' => true,
    //Actions is a list of actions to fire when the trigger is true
    'actions' => array(
        array(
            'name' => 'SetPanelVisibility',
            'params' => array(
                'target' => 'detailpanel_2',
                'value' => 'true',
            ),


'value' => 'true',
            ),
        )
    ),
    //notActions is a list of actions to fire when the trigger is false
    'notActions' => array(
        array(
            'name' => 'SetPanelVisibility',
            'params' => array(
                'target' => 'detailpanel_2',
                'value' => 'false',
            ),
        ),
    ),
);
Once you haveÂ the file in place, you will need to navigate to Admin > Repairs > andÂ runÂ a Quick Repair and Rebuild.
Note: It is important that the module name is plural ('Cases' vs. 'Case') and that the name of the dependency, "panel_2_visibility" in this example,Â isÂ unique.
Â
  	Last modified: 2023-02-03 21:04:03


Extending Sugar Logic
Overview
How to write custom Sugar Logic functions.
Writing a Custom Formula Function
The most important feature of Sugar Logic is that it is simply and easily extendable. Both custom formula functions and custom actions can be added in an upgrade-safe manner to allow almost any custom logic to be added to Sugar. Custom functions will be stored in ./custom/include/Expressions/Expression/{Type}/{Function_Name}.php.
The first step in writing a custom function is to decide what category the function falls under. Take, for example, a function for calculating the factorial of a number. In this case, we will be returning a number so we will create a file in ./custom/include/Expressions/Expression/Numeric/ called FactorialExpression.php. In the new PHP file we just created, we will define a class called FactorialExpression that will extend NumericExpression. All formula functions must follow the format {functionName}Expression.php and the class name must match the file name.
Next, we need to decide what parameters the function will accept. In this case, we need take in a single parameter, the number to return the factorial of. Since this class will be a sub-class of NumericExpression, it by default accepts only numeric types and we do not need to worry about specifying the type requirement.
Next, we must define the logic behind evaluating this expression. So we must override the abstract evaluate() function. The parameters can be accessed by calling an internal function getParameters() which returns the parameters passed into this object. So, with all this information, we can go ahead and write the code for the function.
Note: For the custom function to appear in Studio after completing these steps, you must compile your code by running the Rebuild Sugar Logic Functions job in Admin > Schedulers and then clear your browser cache.
<?php
require_once 'include/Expressions/Expression/Numeric/NumericExpression.php';
class FactorialExpression extends NumericExpression