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 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.
New to Sugar? Sugar's On-Boarding Developer Framework guides you through the process to start developing with Sugar
Topics
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 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.
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.
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.