SugarCRM SupportKnowledge BaseStudio and Module BuilderSugar Logic

Sugar Logic

The Sugar Logic section of the Knowledge Base includes articles covering the use of dependent and calculated fields. Topics range from introductory information to example Sugar Logic formulas, to detailed walkthroughs of how to construct various fields and formulas.

Topics

    Sugar Logic enables administrators to create business logic for field calculations without needing to write PHP code. The field's dynamic value will be automatically updated based on a calculation you provide.
    This article will walk through how to combine four Sugar Logic functions (ifElse, isWithinRange, greaterThan, rollupSum) in a formula to add the likely values of all opportunities related to an account and then calculate a corresponding discount based on that value.
    This article will walk through how to use the greaterThan(), rollUpSum(), addDays(), and several other functions in a Sugar Logic formula to populate a custom date field based on the value of a related module field. Specifically, the date field will calculate when to set a call related to a contact. The call record will be created via Sugar Workflows and the number of days out we set the date will be dependent on the contact's related account type.
    This article will walk through how to use the related() function in a Sugar Logic formula to automatically pull a related contact's phone number into a custom field in the Calls module.
    Contacts in Sugar® may occasionally have their names modified, for example, if they get married and change their last name. When the contact's name is updated in Sugar, the historical name information is not available. This may result in failed searches for users who are not aware that the contact's name has changed. In order to prevent situations like this, we will go over how to create a calculated value field that will hold all revisions of the contact's name and allow searching based on the current and all previous values of the name field.
    This article will present an example formula for a calculated field which totals the sum of several other fields including those which may be empty or contain NULL values by using the numeric value of zero for any blank fields.
    This article will walk through how to use the concat() function in a Sugar® Logic formula to combine any number of strings separated by commas into a single string. Specifically, we will combine the first name and last name fields of a module. This process is called concatenation.
    This article will walk through how to combine the to String(), subStr(), and date() functions in a Sugar® Logic formula to copy only the date portion of a datetime field into a custom calculated date field.
    This article will walk through how to use the getDropdownValue() function in a Sugar Logic formula to copy a value from a dropdown field into a custom text field.
    This article will walk through how to use the daysUntil() and subtract() functions in a Sugar Logic formula to determine the number of days between two date fields.
    When using Sugar®, you may wish to know whether a particular field contains a value or is blank. For example, you could create a calculated field to determine and store whether another field is populated in order to identify records with missing information. Another use might be to make a field's visibility dependent on whether a second field is populated or not. Both can be done using a Sugar Logic formula. Sugar's database has two potential values that would make a field display as blank in Sugar: the field can be empty, or it can contain "NULL". The formula provided in this article addresses both situations. For an overview on Sugar Logic and Calculated Fields, please refer to the article Introduction to Calculated Fields.
    This article will present a Sugar Logic formula that isolates the month portion of a date field into a custom calculated field. We then extend this field's use to create another custom calculated field that displays both the month and year of the date field.
    This article will present an example formula for a calculated field that will format the value entered in the Office Phone field into a specific format such as +1 (XXX) XXX-XXXX (standard US format). For more information on standard phone number formats, please refer to this article available on wikipedia.org.
    This article will walk through how to use the createList() and isInList() functions in a Sugar Logic formula to aggregate the values of several drop-down fields and return a string result.
    Sugar® allows you to create calculated fields which count a record's number of related records. While this type of calculated field can be useful in counting any type of related record, this article will focus on counting related activity records (e.g. calls, meetings, tasks, emails, and notes) as an example. The activity record count may then be used to gain insight into how your organization is communicating with contacts, leads, accounts, etc. or to identify individual relationships which would benefit from additional communication.
    This article will walk through how to use the today() function in a Sugar Logic formula to display a field only if a specified date field is set to today.
    This article will present an example formula for a dependent field that only appears when a field on the record matches a list of acceptable values.
    This article will walk through how to use the related() and equal() functions in a Sugar Logic formula for a dependent field that should only appear based on the value of a specified field in a related module.

Last modified: 08/30/2016 02:10pm