SugarCRM SupportDocumentationSugar DeveloperSugar Developer Guide 8.0Cookbook

Cookbook

Welcome to the SugarCRM Developer Cookbook! This library is filled with real-world code examples for common Sugar customizations and best practices. Sugar's developer community 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.

Topics

    This example explains how to add additional buttons to the application footer. We will create a custom view and then append the view component to the footer layout metadata. The additional button will merely show an alert, but can be expanded on to do much more.
    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 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 "My Dashboard" and "Help Dashboard" comes out-of-the-box with Sugar® to display on the home page. Users have the ability to modify the dashboard layout, rename/delete dashboards, as well as create new dashboards on their home page. Currently, Sugar imposes a limit of 20 dashboards that can be displayed in the Home menu. So, when creating multiple dashboards, keep in mind that having more than 20 in the list of available dashboards will cause the ones (e.g. My Dashboard and Dashboard 1) in the beginning to be dropped off the list. There is an existing enhancement request to allow more than 20 dashboards to be available to display in the Home menu. 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 action 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 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 will 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: 2018-04-27 19:43:07