SugarCRM SupportProduct GuidesSugar DeveloperSugar Developer Guide 12.3Cookbook
This release is only available for SugarCloud customers.


Welcome to the SugarCRM Developer Cookbook! This library is filled with real-world code examples for common Sugar customizations and best practices. Sugar's DevClub is always cooking up new ideas, so be sure to check in often and see what's new. Get started by browsing the categories below.


    This example explains how to create additional buttons on the record view and add events. We will extend and override the stock Accounts record view to add a custom button. The custom button will be called "Validate Postal Code" and ping the Zippopotamus REST service to validate the records billing state and postal code.
    This page explains how to add additional field validation to the record view. In the following examples, we will extend and override the stock Accounts record view to add custom validation. The custom validation will require the Office Phone field when the account type is set to "Customer" and also require the user to enter at least one email address.
    There may be times when you want to reuse a file attached to one Note record as an attachment for an Email, similar to the ability in the Compose Email view to add an attachment using 'Sugar Document'.
    This example explains how to add an emails field for modules that don't extend the Person module template. We will create an email field and bring the email functionality module bean. The steps are applicable for stock and custom modules. In this example, we will add the email field into the Opportunities module.
    Address fields in Sugar® are normally text fields, which allow users to enter in the appropriate information (e.g. street, city, and country) for the record. However, with multiple users working in Sugar, it is possible for data (e.g. country) to be entered in a variety of different ways (e.g. USA, U.S.A, and United States) when creating or editing the record. This can cause some issues when creating a report grouped by the Billing Country field, for example, as records with the same country will be grouped separately based on the different ways the country was entered.
    When creating a call or meeting directly from the Calls or Meetings module in Sugar, the default module for the Related To field is Accounts. If your sales team frequently schedules calls and meetings related to records from a module other than Accounts, it may make sense to adjust the behavior so that the Related To field defaults to a more commonly used module. This article covers how to change the default related module for calls and meetings in Sugar.
    In this example, we create a custom field type called "Highlightfield", which will mimic the base text field type with the added feature that the displayed text for the field will be highlighted in a color chosen when the field is created in Studio.
    This article will cover the two approaches to creating an auto-incrementing field in Sugar.
    The copy action on the record view allows for users to duplicate records. This article will cover the various ways to customize the prefill fields on the copy view.
    The Emails module in Sugar® displays commonly-used buttons in the HTML editor. This article explains how to modify the buttons on the editor's toolbar.
    When searching a Sidecar module's list view, Sugar® begins returning results automatically once a predefined number of milliseconds have passed. This article covers how to customize the start speed of the list view search for Sidecar modules in Sugar.
    How to disable Revenue Line Item (RLI) alerts on Opportunities using a custom JavaScript controller.
    This article will demonstrate how to disable the tooltips in Sugar.
    This article will demonstrate how to dynamically hide subpanels that are dependent on record values by overriding the subpanels layout for a module. This example is for an account record where we will hide the Contacts subpanel when the account type is not 'Customer'.
    When designing a custom module in Module Builder, you have the option to enable importing for the module. If the custom module is deployed without enabling this option, it is not recommended that you redeploy the module since any changes made in Studio and potentially other areas of the application could be lost. This article will cover how to enable importing for custom modules via a code-level change to preserve any additional configurations made to the module since being deployed from Module Builder.
    By default, the "Home Dashboard" comes out-of-the-box with Sugar® to display on the home page. In addition, Sugar users with a Sugar Serve and/or Sugar Sell license type will have access to specialized Home page dashboards called "Service Console" and "Renewals Console". Users have the ability to create new dashboards on their home page and build out its layout and dashlet set. Currently, Sugar imposes a limit of 50 dashboards that can be displayed under the Home module tab. So, when creating multiple dashboards, keep in mind that having more than 50 in the list of available dashboards will cause the ones in the beginning to be dropped off the list. This article covers how to increase the number of dashboards allowed in the Home menu via a code-level customization.
    These pages demonstrate some common examples of working with logic hooks in Sugar.
    Each calendar event type (Meetings, Calls, and Tasks) has its own distinct color scheme. This article will review how to modify these colors, as well as demonstrate how to set the event color based on the event status.
    By default, the record view layout for each module displays two columns of fields. The number of columns to display can be customized on a per-module basis with the following steps.
    Several buttons exist on each subpanel by default such as "Create" (+ Plus symbol) and "Link Existing Record". These buttons are controlled by the panel-top view for each module. To make changes to the buttons included in a subpanel layout, you will need to create an override for the panel-top view in ./custom/Extension/modules/<module>/Ext/clients/base/views/panel-top/ and update the corresponding buttons property to include or exclude a button.
    Examples working with the module loadable packages.
    This example explains how to add additional buttons to a new section in the sidebar nav layout. You may have previously customized a button that was added to the footer layout, which can be repurposed here and added to the sidebar-nav layout. We will create a custom view and append the view component to the sidebar-nav layout metadata. The additional button will merely show an alert and a flyout menu with a link to the Accounts module but can be expanded to do much more.
    This page explains how to create a custom view component that passes data to the Handlebars template.
    When composing an email in Sugar, it may be useful to modify the compose view to better suit your common business practices. In this article, we will use JavaScript to create a code-level customization which causes the To, CC, and Subject fields of the email to prepopulate with data from a related Opportunity.
    How to refresh specific subpanels on the Record View.
    This article covers how to remove the Account field from being required on the Opportunities module.
    Examples when working with Sugar's web service endpoints.

Last modified: 2022-11-08 15:48:54