id
stringlengths 14
16
| text
stringlengths 33
5.27k
| source
stringlengths 105
270
|
---|---|---|
9dcdcdd83911-4
|
component.show();
}
}
})
Once the file is in place, run a Quick Repair and Rebuild. The changes will then be reflected in the Accounts record view.
Related
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/index.html
|
9b788d965a7d-0
|
Changing the Default Module When Logging a New Call or Meeting
Overview
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.
Note: This article pertains to Sugar versions 6.x and 7.x.
Prerequisites
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_the_Default_Module_When_Logging_a_New_Call_or_Meeting/index.html
|
9b788d965a7d-1
|
Prerequisites
This change requires code-level customizations, which requires direct access to the server or familiarity with creating and installing module loadable packages. If you need assistance making these changes and already have a relationship with a Sugar partner, you can work with them to make this customization. If not, please refer to the Partner Page to find a reselling partner to help with your development needs.
Note: Sugar Sell Essentials customers do not have the ability to upload custom file packages to Sugar using Module Loader.
Steps to Complete
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_the_Default_Module_When_Logging_a_New_Call_or_Meeting/index.html
|
9b788d965a7d-2
|
Steps to Complete
For this example, we will change the default "Relates To" module to Contacts for records created in the Calls module and the Meetings module. Please note that, after completing these steps, the Related To field will still default to Accounts when creating a call or meeting from a contact that has an account relationship or to the current module from any other related module's record view.
Calls
Create the following directory path if it does not already exist from the root of your Sugar instance directory:./custom/Extension/modules/Calls/Ext/Vardefs/
Create a file in the directory called sugarfield_parent_type.php with the following contents:<?php
$dictionary['Call']['fields']['parent_type']['default'] = 'Contacts';
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_the_Default_Module_When_Logging_a_New_Call_or_Meeting/index.html
|
9b788d965a7d-3
|
Save the file and ensure that the file has the correct permissions by referring to the Required File System Permissions on Linux and Required File System Permissions on Windows With IIS articles.
Log into Sugar as an administrator and navigate to Admin > Repair and perform a Quick Repair and Rebuild.
Once the quick repair completes, navigate to the Calls module and "Contact" should now be selected by default for the Related To field when logging a new call.
Meetings
Create the following directory path if it does not already exist from the root of your Sugar instance directory: ./custom/Extension/modules/Meetings/Ext/Vardefs/.
Create a file in the directory called sugarfield_parent_type.php with the following contents:<?php
$dictionary['Meeting']['fields']['parent_type']['default'] = 'Contacts';
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_the_Default_Module_When_Logging_a_New_Call_or_Meeting/index.html
|
9b788d965a7d-4
|
Save the file and ensure that the file has the correct permissions by referring to the Required File System Permissions on Linux and Required File System Permissions on Windows With IIS articles.
Log into Sugar as an administrator and navigate to Admin > Repair and perform a Quick Repair and Rebuild.
Once the quick repair completes, navigate to the Meetings module and "Contact" should now be selected by default for the Related To field when scheduling a new meeting.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_the_Default_Module_When_Logging_a_New_Call_or_Meeting/index.html
|
c6b990befb4e-0
|
Adding an Existing Note to an Email as Attachment
Overview
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'.
Key Concepts
There are two key things to understand when implementing this functionality:
You can not relate an existing Note record to an Email record. This will throw an Exception in the API as intended. A note that is used as an attachment can only exist once and can not act as an attachment across multiple emails.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-1
|
You can create a new Note record that uses an existing Note's attached file. Doing so essentially requires setting the upload_id field of the new Note record to the id of the existing Note you want to reuse the file from, and setting the file_source field of the new Note to 'Notes'. In addition to needing to set the upload_id, you must also set the filename and name field.
The following examples demonstrate how to do this in three different contexts: server-side (SugarBean/PHP), client-side (sidecar/Javascript), and purely through the API. But all three contexts follow the same essential steps:
Fetch the original Note record;
Create a new Note record, setting the necessary fields from the original Note record;
Link the new Note record to the Email record via the appropriate 'attachments' link.
PHP
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-2
|
PHP
This example would be done server-side using the SugarBean object, similar to how you might interact with the records in a custom Logic Hook or Scheduler job.
$original_note_id = '4e226282-8158-11e8-a1b3-439fe19c087a';
$email_id = 'e3e058f4-7f11-11e8-ba11-fcdd97d61bbe';
// 1. Fetch Original Note:
$original_note = BeanFactory::retrieveBean('Notes', $original_note_id);
// 2. Create a new note based on original note, setting upload_id, name, and filename:
$new_note = BeanFactory::newBean('Notes');
$new_note->upload_id = $original_note->getUploadId();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-3
|
$new_note->upload_id = $original_note->getUploadId();
$new_note->file_source = 'Notes';
$new_note->filename = $original_note->filename;
$new_note->name = $original_note->filename;
// 3. Relate the new note to Email record using 'attachments' link:
$email = BeanFactory::retrieveBean('Emails', $email_id);
$email->load_relationship('attachments');
$email->attachments->add($email, $new_note);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-4
|
$email->attachments->add($email, $new_note);
Note that in most contexts, such as a Logic Hook or a custom endpoint, you will not need to call save() on either the $new_note or $email for $new_note to be related as an attachment to $email and for $new_note to save. The $new_note record will save as part of being linked to $email.
Javascript
The following example is totally standalone within Sidecar, demonstrating how to fetch the existing Note using app.data.createBean and bean.fetch(), create the new Note using app.data.createBean and setting the relevant fields, and then adding the new Note to the email records attachments_collection.
var original_note_id = '4e226282-8158-11e8-a1b3-439fe19c087a';
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-5
|
var email_id = 'e3e058f4-7f11-11e8-ba11-fcdd97d61bbe';
// 1. Fetch Original Note:
var original_note = app.data.createBean('Notes');
original_note.set('id', original_note_id);
original_note.fetch();
// 2. Create a new note based on original note, setting upload_id, name, and filename:
var new_note = app.data.createBean('Notes', {
_link: 'attachments',
upload_id: original_note.get('id'),
file_source: 'Notes',
filename: original_note.get('filename'),
name: original_note.get('filename'),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-6
|
name: original_note.get('filename'),
file_mime_type: original_note.get('file_mime_type'),
file_size: original_note.get('file_size'),
file_ext: original_note.get('file_ext'),
});
// 3. Relate the new note to Email record using 'attachments_collection' link:
var email = app.data.createBean('Emails');
email.set('id', email_id);
email.fetch();
email.get('attachments_collection').add(new_note,{merge:true});
email.save();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-7
|
email.save();
Note: In the above example, the fields file_mime_type, file_size, and file_ext are also set. This is assuming a context where the customization is adding the attachments to the Compose Email view. Setting these fields makes the new attachments look correct to the user before saving the Email, but these fields are otherwise set automatically on save. If extending the actual compose view for emails, you also wouldn't fetch the email directly. This is added in this example purely for demonstration purposes.
REST API
The following section will outline how to related the attachment using the REST API using the /link/attachments/Â endpoint for the Email record.
Fetch Original Note
To fetch the original note, send a GET request to rest/{REST VERSION}/Notes/{$original_note_id}. An example of the response is shown below :
{
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-8
|
{
"id": "4e226282-8158-11e8-a1b3-439fe19c087a",
"name": "Note with Attachment",
"date_entered": "2018-07-01T12:00:00-00:00",
"description": "Send to special clients.",
"file_mime_type": "application/pdf",
"filename": "special_sales_doc.pdf",
"_module": "Notes"
}
Create and Relate a Note
Create a JSON object based on the response (which we will treat as a JSON object named $original_note) like:
{
"upload_id": "$original_note.id",
"file_source" : "Notes"
"name" : "$original_note.filename",
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
c6b990befb4e-9
|
"name" : "$original_note.filename",
"filename" : "$original_note.filename",
}
Relate the Note to the Email record using the 'attachments' link. Next, send a POST request to rest/{REST VERSION}/Emails/{$email_id}/link/attachments/Â with the JSON shown above as the request body.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_an_Existing_Note_to_an_Email_as_Attachment/index.html
|
29899e5d082d-0
|
Customizing Prefill Fields When Copying Records
Overview
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.
Modifying the Copy Prefill View Using the Vardefs
The following section will outline how to modify the fields that are prefilled when copying a Bug record from the record view using the beans Vardefs. This is helpful when the list of copied fields are static and have no dependencies. You can apply this to any module in the system.
./custom/Extension/modules/Bugs/Ext/Vardefs/copyPrefill.php
<?php
//remove a field from copy
$dictionary['Bug']['fields']['description']['duplicate_on_record_copy'] = 'no';
//add a field to copy
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_Prefill_Fields_When_Copying_Records/index.html
|
29899e5d082d-1
|
//add a field to copy
$dictionary['Bug']['fields']['priority']['duplicate_on_record_copy'] = 'always';
Once in place, navigate to Admin > Repair > Quick Repair & Rebuild.
Note: You can name the file 'copyPrefill.php' anything you like. We advise against making these changes in the ./custom/Extension/modules/<module>/Ext/Vardefs/sugarfield_<field>.php files as these changes may be removed during studio edits.
Modifying the Copy Prefill View Using JavaScript Controllers
The following section will outline how to modify the fields that are prefilled when copying a Bug record from the record view using the JavaScript Controller. This is helpful when you need to dependently determine the fields to copy by a field on the bean. You can apply this to any module in the system.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_Prefill_Fields_When_Copying_Records/index.html
|
29899e5d082d-2
|
./custom/modules/Bugs/clients/base/views/record/record.js
({
extendsFrom: 'RecordView',
setupDuplicateFields: function (prefill) {
this._super('setupDuplicateFields', prefill);
var fields = [
'name',
'assigned_user_id',
'priority',
'type',
'product_category',
'description'
];
//determines whether the field list above is a set of allowlisted (allowed) or denylisted (denied) fields
var denylist = false;
if (denylist) {
_.each(fields, function (field) {
if (field && prefill.has(field)) {
//set denylist field to the default value if exists
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_Prefill_Fields_When_Copying_Records/index.html
|
29899e5d082d-3
|
//set denylist field to the default value if exists
if (!_.isUndefined(prefill.fields[field]) && !_.isUndefined(prefill.fields[field].default)) {
prefill.set(field, prefill.fields[field].default);
} else {
prefill.unset(field);
}
}
});
} else {
_.each(prefill.fields, function (value, field) {
if (!_.contains(fields, field)) {
if (!_.isUndefined(prefill.fields[field].default)) {
prefill.set(field, prefill.fields[field].default);
} else {
prefill.unset(field);
}
}
});
}
}
})
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_Prefill_Fields_When_Copying_Records/index.html
|
29899e5d082d-4
|
}
}
});
}
}
})
Once in place, navigate to Admin > Repair > Quick Repair & Rebuild. The denylist variable will determine whether the list of fields are allowlisted or denylisted from the copy feature.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_Prefill_Fields_When_Copying_Records/index.html
|
a16ab1234acb-0
|
Security
Security documents for securing Sugars infastructure.
TopicsEndpoints and Entry PointsThis document describes how to disable out of the box REST API endpoints and legacy MVC entry points.Web Server ConfigurationThis document serves as a guideline to harden the web server configuration with regard to running SugarCRM. Note that this is a guideline and certain settings will depend on your specific environment and setup. This guideline focuses on Apache web server as this is SugarCRM's primary supported web server. However, the recommendations in this document apply to all web servers in general.XSS PreventionThis document describes how to prevent cross-site scripting (XSS) attacks in Sugar customizations. XSS attacks occur when malicious entities are able to inject client-side scripts into web pages.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/index.html
|
3a2c337e2ee7-0
|
XSS Prevention
Overview
This document describes how to prevent cross-site scripting (XSS) attacks in Sugar customizations. XSS attacks occur when malicious entities are able to inject client-side scripts into web pages.
Best Practices
When creating custom code for Sugar, be sure to respect the following best practices. These rules serve to protect the elements of your customizations that are most susceptible to XSS vulnerabilities:
Create safe variables when injecting HTML via Handlebars templates or JavaScript methods such as: $(selector).html(variable), $(selector).before(variable), or $(selector).after(variable).
Avoid using triple-bracket (e.g. {{{variable}}}) syntax to allow unescaped HTML content in Handlebars templates.
Never use input from an unknown source as it may contain unsafe data.
Protect dynamic content, which may also contain unsafe data.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-1
|
Protect dynamic content, which may also contain unsafe data.
Please refer to the following sections for more information and examples that demonstrate these best practices.
Creating Safe Variables
You must always encode a variable before you inject or display it on a webpage. The piece that is not encoded should be isolated and marked as a safe string very carefully. The the following sections outline protecting your system when using JavaScript and Handlebars templates.
JavaScript
To ensure displayed JavaScript variables are safe, respect these two rules:
If you are displaying plain text without any HTML, use .text() instead of .html() with your selectors.
If your text contains HTML formatting, you can use .html()Â as long as it does not contain any dynamic data coming from a variable.
Vulnerable Setup
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-2
|
Vulnerable Setup
This is an example of bad code because it utilizes the .html() method to display a dynamic-value variable, leaving the JavaScript vulnerable to injection:
var inputData = $('#myInput').val(); // "<script>alert(0)</script>"
$(selector).html('This is the value: ' + inputData); // "This is the value: <script>alert(0)</script>"
Protected Setup
This is an example of good code, which uses the safe .text() method to protect the JavaScript from potential injection:
var status = 'safe';
$(selector).text('This is very ' + status); // "This is very safe"
This is also an acceptable approach, which uses the Handlebars.Utils.escapeExpression to safely escape the content:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-3
|
var inputData = $('#myinput').val(); // "<script>alert(0)</script>"
var safeData = Handlebars.Utils.escapeExpression(inputData); // "<script>alert(0)</script>"
$(selector).html('This is the value: ' + safeData); // "This is the value: <script>alert(0)</script>"
Handlebars Templates
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-4
|
Handlebars Templates
Handlebars, by default, handles the encoding of data passed to the template in double brackets (e.g. {{variable}}), however, it also allows you to bypass this encoding by using triple brackets (e.g. {{{variable}}}). Text passed via triple brackets will not be encoded. As a rule, do not use triple brackets. If you don't want Handlebars to encode a piece of a string, use double brackets and execute Handlebars.SafeString() in your JavaScript controller.Â
As an example, we will apply best practices to a complex use case with dynamic values that need to be encoded. For this example, we want to display a message similar to:
Congrats! You just created the record <a href="/#Accounts/abcd">ABCD</a>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-5
|
The values ABCD and /#Accounts/abcd are dynamic values and, therefore, must be encoded. But the message must also be displayed as HTML, so the overall element cannot be entirely encoded. To address this use case, we must properly script the JavaScript controller and the Handlebars template.
The following JavaScript encodes the message's dynamic values, marks the displayed hyperlink as a safe string, and then outputs the safe message:
var record = {
id: 'abcd',
name: 'ABCD'
};
// escape `ABCD`
var safeName = Handlebars.Utils.escapeExpression(record.name);
// escape `abcd`
var safeId = Handlebars.Utils.escapeExpression(record.id);
// Mark the link as a SafeString now that the unsafe pieces are encoded and the content has safe HTML.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3a2c337e2ee7-6
|
var link = new Handlebars.SafeString('<a href="/#Accounts/' + safeId + '">' + safeName . '</a>');
// This can be displayed with double brackets in the template because html parts will not be encoded.
this.safeMessage = new Handlebars.SafeString('Congrats! You just created the record ' + link + '.');
To display the safe message in the application, use the following syntax in your Handlebars template:
<div class="success">{{safeMessage}}</div>
Please refer to the HTML Escaping documentation on the Handlebars website for more information.Â
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/XSS_Prevention/index.html
|
3392ec99ea44-0
|
Endpoints and Entry Points
Overview
This document describes how to disable out of the box REST API endpoints and legacy MVC entry points.
Advisory ID: sugarcrm-sr-2015-001Revision: 1.1Last updated: 2015-10-01
Description
SugarCRM has both legacy entry points and REST API endpoints which are shipped out of the box. Not every customer uses all capabilities of the SugarCRM product. To harden the configuration both entry points can be disabled based on the customer's requirements.
Legacy Entry Points
All stock entry points are defined in include/MVC/Controller/entry_point_registry.php. Using the SugarCRM Extension framework the configuration directives can be overridden in an upgrade safe manner. As an example consider the entrypoint "removeme". To disable this entrypoint use the following procedure.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Endpoints_and_Entry_Points/index.html
|
3392ec99ea44-1
|
Create a new php file ./custom/Extension/application/Ext/EntryPointRegistry/disable_removeme.php and add the following content:
<?php
if (isset($entry_point_registry['removeme'])) {
unset($entry_point_registry['removeme']);
}
Execute a quick repair and rebuild as SugarCRM administrator. The entry point is now fully disabled and no longer accessible to respond to any calls. Note that when trying to hit an non-existing (or disabled) entry point, the application will redirect you to the homepage (or login screen if the user has no session).
REST API Endpoints
To disable the HelpAPI which is located at clients/base/api/HelpApi.php use the following procedure.
Create a new php file custom/clients/base/api/CustomHelpApi.php and add the following content:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Endpoints_and_Entry_Points/index.html
|
3392ec99ea44-2
|
<?php
require_once 'clients/base/api/HelpApi.php';
class CustomHelpApi extends HelpApi
{
public function getHelp($api, $args)
{
throw new SugarApiExceptionNotFound();
}
}
Execute a quick repair and rebuild as SugarCRM administrator. The entry point is now fully disabled. When making a REST API call to /rest/v10/help the followingHTTP 404 Not Found error will be returned:
{
"error": "not_found",
"error_message": "Your requested resource was not found."
}
Publication History
2015-10-01
Adding REST API endpoint example
2015-06-16
Initial publication
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Endpoints_and_Entry_Points/index.html
|
3392ec99ea44-3
|
Adding REST API endpoint example
2015-06-16
Initial publication
A stand-alone copy of this document that omits the distribution URL is an uncontrolled copy, and may lack important information or contain factual errors. SugarCRM reserves the right to change or update this document at any time.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Endpoints_and_Entry_Points/index.html
|
614463bb95e3-0
|
Web Server Configuration
Overview
This document serves as a guideline to harden the web server configuration with regard to running SugarCRM. Note that this is a guideline and certain settings will depend on your specific environment and setup. This guideline focuses on Apache web server as this is SugarCRM's primary supported web server. However, the recommendations in this document apply to all web servers in general.
Advisory ID: sugarcrm-sr-2015-003Revision: 1.1Last updated: 2015-10-01Â
SugarCRM .htaccess file
During installation, SugarCRM deploys an .htaccess file in SugarCRM's root folder. The content of this file may change during upgrades as well. The primary configuration directives managed by SugarCRM are focused around disabling direct access to certain directories and files. Secondly, the configuration contains specific URL rewrite rules which are required for SugarCRM.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-1
|
Although this file can be used to ship most of the settings which are explained in this document to harden the web server, SugarCRM has chosen not to do so as most of them depend on the customer's setup which cannot be fully controlled by the SugarCRM application itself.
All directives which are managed by SugarCRM are placed between the following markers inside the .htaccess file:
# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 .*\.log$
...
# END SUGARCRM RESTRICTIONS
Customers can add additional directives if need. Make sure to put those directives outside of the above-mentioned markers. SugarCRM can rebuild during upgrades all directives enclosed in the above markers.
Securing .htaccess
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-2
|
Securing .htaccess
Apache allows admins to drop in .htaccess files in any given directory. When a request comes in, Apache will scan the directory recursively for any .htaccess file and apply its configuration directives. This ability is orchestrated by the AllowOverride directive which is enabled by default on most Apache configurations.
To disable this dynamic Apache configuration behavior, disable AllowOverride and make sure to copy paste the .htaccess file content as well.
<Directory "/var/www/html">
AllowOverride None
# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 .*\.log$
...
# END SUGARCRM RESTRICTIONS
</Directory>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-3
|
...
# END SUGARCRM RESTRICTIONS
</Directory>
When choosing for this security measure, make sure to verify if any changes have happened in the .htaccess after an upgrade. Those changes need to be applied manually back in the Apache configuration to ensure SugarCRM functions properly. Disabling the .htaccess file support also has a positive impact on the performance as Apache will no longer need to scan for the presence of .htaccess files.
Although Apache does not allow to download .htaccess files, to tighten the security around .htaccess, even more, the following directives can be added:
<Files ".ht*">
Order deny,allow
Deny from all
</Files>
Prevent version exposure
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-4
|
Deny from all
</Files>
Prevent version exposure
By default Apache web server exposes its version and OS details in most *nix distributions in both the HTTP response headers as well as on the default error pages. To prevent this behavior use the following configuration directives:
ServerSignature Off
ServerTokens Prod
 The exposure of the PHP version can be disabled in your php.ini file. When exposed an X-Powered-By response header will be added containing the PHP version information.
expose_php = Off
Another option is to unset the header explicitly in the Apache configuration:
<IfModule mod_headers.c>
Header unset X-Powered-By
</IfModule>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-5
|
Header unset X-Powered-By
</IfModule>
Note that unsetting the Server header is not possible using this way. The web server will always respond with a Server header containing the string "Apache". If it is desired to remove this header as well, additional modules need to be used for this (i.e. mod_security can do this).
Directory listing and index page
Make sure to configure a default index page which should only be index.php for SugarCRM. This is mostly configured but worth checking. Additional SugarCRM does not require the directory browsing support and this is recommended to be disabled. This can be accomplished by removing Options Indexes and/or completely disable the mod_autoindex module.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-6
|
Optionally additional Allow/Deny directives can be used to apply access lists to certain directories. It is not recommended to add additional authentication through Apache as SugarCRM already fully manages user authentication. The Allow/Deny directives can still be used to apply any IP access list if required by the customer.
The following example secures the root directory (default configuration), disable directory browsing and an additional IP access list is applied.
DocumentRoot "/var/www/html"
<Directory />
AllowOverride none
Order allow,deny
Deny from all
</Directory>
<Directory "/var/www/html">
DirectoryIndex index.php
Options -Indexes
Order deny,allow
Allow from 10.0.0.0/8
Deny from all
</Directory>
Additional Options directives
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-7
|
Deny from all
</Directory>
Additional Options directives
SugarCRM does not rely on both CGI and SSI and it is recommended to disable this functionality explicitly. Optionally the FollowSymLinks options can also be disabled depending on your directory setup.
<Directory "/var/www/html">
Options -ExecCGI -Includes -FollowSymLinks
</Directory>
Web server permissions
Ensure your web server is configured to run as a dedicated non-privileged user. Certain *nix distributions use out of the box the user/group nobody. It is recommended to use a dedicated user/group instead.
User wwwrun
Group www
Ensure the configured user/group have the proper file and directory permissions for SugarCRM. See the installation/upgrade guide for more detailed instructions regarding the required permissions.
Disable unnecessary loadable modules
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-8
|
Disable unnecessary loadable modules
Apache is pluggable by means of loadable modules. To minimize the chances of becoming a victim of an attack it is recommended to disable all loadable modules which are not needed. SugarCRM recommends the following base Apache modules:
mod_authz_host
mod_dir
mod_expires
mod_rewrite
mod_headers
mod_mime
mod_alias
From an Apache perspective to disable a loadable module, it is sufficient to comment out the LoadModule directives. However certain *nix distribution has additional configuration scripts to manage the loaded Apache modules. Please refer to your *nix distribution for this.
Based on your setup additional Apache modules can be used. When using MPM prefork you will also need mod_php5 and when terminating secure HTTP connection on the web server directly also mod_ssl (see below).
HTTP methods
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-9
|
HTTP methods
HTTP uses different methods (verbs) in requests. As per RFC-7231 for HTTP/1.1 different request methods are defined which serve the primary source of the request semantics. The following methods are used by SugarCRM:
For new REST API:
GET
POST
PUT
DELETE
HEAD (*)
OPTIONS (*)
Bootstrap, BWC access, old SOAP/REST API:
GET
POST
(*) Currently not in use, but may be implemented in the future.
The new REST API is accessed using the URL "/rest/vxx/â¦" where xxx represents the API version number. To harden the usage of the additional HTTP methods the following directives can be used for the new REST API endpoint while only allowing GET and POST on the legacy access.
<Directory "/var/www/html">
<LimitExcept GET POST>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-10
|
<Directory "/var/www/html">
<LimitExcept GET POST>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
<Location "/rest">
<LimitExcept GET POST PUT DELETE>
Order deny,allow
Deny from all
</LimitExcept>
</Location>
<Location "/api/rest.php">
<LimitExcept GET POST PUT DELETE>
Order deny,allow
Deny from all
</LimitExcept>
</Location>
Instead of using the Limit directive, an alternative is using mod_allowmethods which is available since Apache 2.4. However this module is flagged as experimental.
Secure HTTP traffic
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-11
|
Secure HTTP traffic
SugarCRM requires the usage of HTTPS transport without any exception. Depending on your setup you can terminate the secure connection on a separate endpoint (load balancer, dedicated HTTPS termination point) or directly on the web server(s). You will also need a valid private key and X.509 certificate. In most cases, the customer needs to acquire an X.509 certificate through a public certification authority of their choice. For internal deployments, this may not be necessary when a local PKI environment is available.
When terminating the secure connection directly on the Apache web server, mod_ssl is required. A dedicated VirtualHost needs to be configured on port 443 (standard HTTPS port). The following is a basic SSL/TLS configuration as a reference. More details are covered in the next paragraphs.
<VirtualHost 1.2.3.4:443>
SSLEngine on
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-12
|
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/example.com.crt
SSLCertificateKeyFile /etc/pki/tls/certs/example.com.key
SSLCertificateChainFile /etc/pki/tls/certs/example_bundle.crt
ServerName crm.example.com
</VirtualHost>
Make sure to have your server name properly configured as it should match the X.509 certificate's CommonName (or one of the SNA's, subject alternative names). More information regarding the certificate requests including the certificate chain can be obtained from your certification authority.
Ensure to redirect all non-secure HTTP (port 80) traffic to the secure virtual host.
<VirtualHost *:80>
Redirect "/" "https://crm.example.com/"
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-13
|
Redirect "/" "https://crm.example.com/"
</VirtualHost >
Cipher suite hardening
One of the crucial points of HTTPS is to force only secure cryptographic algorithms. Based on new future weaknesses which may be discovered in the future the recommended cipher suite settings can change. As per publish date of this document the usage of SSLv2 and SSLv3 is recommended to be disabled. The current safe secure transport protocols are TLSv1.0, TLSv1.1, and TLSv1.2 with properly configured cipher suites.
For proper deployment of Diffie-Hellman (DH) key exchange algorithms the following guidelines apply:
No longer use out-dated export cipher suites
Ensure the usage of Elliptic Curve Diffie-Hellman (ECDHE) based algorithms
Use of non-common Diffie-Hellman groupsÂ
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-14
|
Use of non-common Diffie-Hellman groupsÂ
More detail around the DH configuration and a detailed list of recommended cipher suites including web server configuration examples can be found at https://weakdh.org/sysadmin.html. Additionally, an online SSL/TLS checker can be used to generate a full report of your current configuration in case your web server is publically reachable. A recommended tool is https://www.ssllabs.com/ssltest/analyze.html. The output of this SSL/TLS test suite will guide you into further (optional) details which can be tweaked regarding your configuration (i.e. OCSP stapling, certificate pinning, â¦).
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-15
|
Please note that using the above instruction "perfect forward secrecy" will be enabled. This basically means that captured TLS traffic can only be decoded using the session key between a specific client and server. Nonperfect forwarding secrecy connections can always be decrypted by having access to only the server's private key. If the customer's setup has intermediate IDS/WAF systems to inspect traffic looking inside the secure traffic, having perfect forwarding secrecy configured may not be desirable.
Public trusted root CA's
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-16
|
Public trusted root CA's
It is recommended that the *nix system where Apache is running always has the latest public root CA (certification authority) files available to authenticate server certificates during the SSL/TLS handshake. Most *nix distributions take care of this through their online update process. If this is not the case, the system administrator is responsible to ensure the latest trusted root CA's are up-to-date. Out of the box, the SugarCRM application contacts the SugarCRM heartbeat and licensing server using a secure connection.
HSTS header
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-17
|
HSTS header
As all traffic requires HTTPS for SugarCRM, it is recommended to configure a global HSTS (HTTP Strict Transport Security) header. This is an additional opt-in security enhancement supported by most modern browsers. The HSTS will instruct the browser to always use HTTPS in the future for the given FQDN. More details regarding HSTS can be found here: https://www.owasp.org/index.php/HTTP_Strict_Transport_Security.
Before enabling the HSTS header, ensure that no other non-HTTPS website is running for the given FQDN and any subdomains.
Header always set Strict-Transport-Security \
"max-age=10886400; includeSubdomains; preload"
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-18
|
"max-age=10886400; includeSubdomains; preload"
Optionally when your SugarCRM application is publically reachable, you can submit your FQDN on the preload which is maintained by Chrome and included by Firefox, Safari, Internet Explorer 11 and Edge browser. Understand the consequences and requirements to end up on the preload list. Once registered, this cannot be undone easily. Submissions for the HSTS preload list can be found at https://hstspreload.appspot.com.
CSP header
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-19
|
CSP header
A Content Security Policy header can be added to offer additional protection against XSS (cross-site scripting). Most modern browsers support CSP and will apply the limitation as directed by the CSP header. The CSP header defines the allowed sources through different directives which are allowed regarding JScript, CSS, images, fonts, form actions, plugins, ⦠More information can be found at https://www.owasp.org/index.php/Content_Security_Policy.
The management of CSP headers can become complex and may depend on different types of customizations which can be deployed on the SugarCRM platform.Â
For now, CSP headers can be configured directly on the web server. A basic configuration looks like this:Â
Header always set Content-Security-Policy \
"default-src 'self'; script-src 'self'"
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-20
|
"default-src 'self'; script-src 'self'"
Note:Â This is a syntax example of a CSP header and not a recommended value.
Older browsers use the header X-Content-Security-Policy or X-WebKit-CSP instead of the standardized one. The CSP header can also safely be added first in "report only" mode before deploying it in production using Content-Security-Policy-Report-Only.
Additional security headers
To prevent clickjacking an X-Frame-Options header can be added. This header can also be used to iframe the SugarCRM application inside another web site if required. This can be better controlled with the above mentioned CSP header. Both can coexist together but it is encouraged to used the CSP approach.
Header always set X-Frame-Options "SAMEORIGIN"
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-21
|
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Frame-Options "ALLOW-FROM https://someothersite.com"
To protect against "drive-by download" attacks, it is encouraged to disable Content-Type sniffing. This is particularly targeted at Chrome and IE.
Header always set X-Content-Type-Options "nosniff"
Ensure XSS browser protection is enabled by adding the following header. By default, this feature should be enabled in every browser. In case it has been disabled, sending this header will re-enable it.
Header always set X-XSS-Protection "1; mode=block"
Secure cookie settings
Ensure the following settings are applied in php.ini to ensure legacy cookies are properly protected against XSS attacks and are only transmitted over a secure HTTPS connection.
session.cookie_httponly = 1
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-22
|
session.cookie_httponly = 1
session.cookie_secure = 1
Additionally, the session.cookie_path can be tweaked if other applications are running on the same web server.
Security modules
Additional Apache loadable security modules exist which can optionally be installed to better protect your system from malicious requests and/or DDOS attacks. The following modules are available for Apache 2.4:
mod_security - This module adds WAF (web application firewall) capabilities to your Apache setup. In combination with the OWASP CRS (core rule set) gives you a solid starting point for a WAF implementation.
mod_evasive - This module helps to prevent (D)DOS attacks
Covering both modules in details is out of the scope of this Security Response. Refer to the module documentation for additional details. In the future, SugarCRM may publish specific settings and fine-tuning for both modules.Â
Additional resources
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
614463bb95e3-23
|
Additional resources
Generic Apache security tipshttp://httpd.apache.org/docs/2.4/misc/security_tips.html
Online SSL/TLS testerhttps://www.ssllabs.com/ssltest/analyze.html
Useful HTTP headershttps://www.owasp.org/index.php/List_of_useful_HTTP_headers
Publication History
2015-10-01
Adding HTTP method restrictions
2015-09-08
Initial publication
A stand-alone copy of this document that omits the distribution URL is an uncontrolled copy and may lack important information or contain factual errors. SugarCRM reserves the right to change or update this document at any time.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Security/Web_Server_Configuration/index.html
|
a6c6a5913b7a-0
|
Data Framework
The Sugar application comprises core elements such as modules, fields, vardefs, and other foundational components. The Data Framework pages document how these core elements are modeled and implemented in Sugar.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/index.html
|
a6c6a5913b7a-1
|
TopicsModulesHow modules are defined and used within the systemModelsAn overview of the SugarBean model.VardefsVardefs (Variable Definitions) provide the Sugar application with information about SugarBeans. Vardefs specify information on the individual fields, relationships between beans, and the indexes for a given bean.FieldsHow fields interact with the various aspects of Sugar.RelationshipsRelationships are the basis for linking information within the system. This page explains the various aspects of relationships. For information on custom relationships, please refer to the Custom Relationships documentation.SubpanelsFor Sidecar, Sugar's subpanel layouts have been modified to work as simplified metadata. This page is an overview of the metadata framework for subpanels.DatabaseAll Sugar products support the MySQL and Microsoft SQL Server databases. Sugar Enterprise and Sugar Ultimate also support the DB2 and Oracle databases. In general, Sugar uses only common database functionality, and the application logic is embedded in the
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/index.html
|
a6c6a5913b7a-2
|
databases. In general, Sugar uses only common database functionality, and the application logic is embedded in the PHP code. Sugar does not use or recommend database triggers or stored procedures. This design simplifies coding and testing across different database vendors. The only implementation difference across the various supported databases is column types.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/index.html
|
a6c6a5913b7a-3
|
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/index.html
|
ae62739d3063-0
|
Models
Overview
Each module in Sugar is extending the Sugar Model. This model is determined by the SugarBean, which contains methods to create, read/retrieve, update, and delete records in the database and any subclass of the SugarBean. Many of the common Sugar modules also use the SugarObjects class, which is explained in the next section.
SugarObject Templates
Sugar objects extend the concept of subclassing a step further and allow you to subclass the vardefs. This includes inheriting of fields, relationships, indexes, and language files. However, unlike subclassing, you are not limited to a single inheritance. For example, if there were a Sugar object for fields used in every module (e.g. id, deleted, or date_modified), you could have the module inherit from both the Basic Sugar object and the Person Sugar object.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
ae62739d3063-1
|
To further illustrate this, let's say the Basic object type has a field 'name' with length 10 and the Company object has a field 'name' with length 20. If you inherit from Basic first and then Company, your field will inherit the Company object's length of 20. However, the module-level setting always overrides any values provided by Sugar objects, so, if the field 'name' in your module has been set to length 60, then the field's length will ultimately be 60.
There are six types of SugarObject templates:
Basic : Contains the basic fields required by all Sugar modules
Person : Based on the Contacts, Prospects, and Leads modules
Issue : Based on the Bugs and Cases modules
Company : Based on the Accounts module
File : Based on the Documents module
Sale : Based on the Opportunities module
SugarObject Interfaces
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
ae62739d3063-2
|
Sale : Based on the Opportunities module
SugarObject Interfaces
In addition to the object templates above, "assignable" object templates can be used for modules with records that should contain an Assigned To field. Although every module does not use this, most modules allow assignment of records to users. SugarObject interfaces allow us to add the assignable attribute to these modules.
SugarObject interfaces and SugarObject templates are very similar to one another, but the main distinction is that templates have a base class you can subclass while interfaces do not. If you look into the file structure, templates include many additional files, including a full metadata directory. This is used primarily for Module Builder.
File Structure
./include/SugarObjects/interfaces
./include/SugarObjects/templates
Implementation
There are two things you need to do to take advantage of Sugar objects:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
ae62739d3063-3
|
There are two things you need to do to take advantage of Sugar objects:
Subclass the SugarObject class you wish to extend for your class:class MyClass extends Person
{
function MyClass()
{
parent::Person();
}
}
Add the following line to the end of the vardefs.php file:VardefManager::createVardef('Contacts', 'Contact', array('default', 'assignable', 'team_security', 'person'));
This snippet tells the VardefManager to create a cache of the Contacts vardefs with the addition of all the default fields, assignable fields, team security fields, and all fields from the person class.
Performance Considerations
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
ae62739d3063-4
|
Performance Considerations
VardefManager caches the generated vardefs into a single file that is loaded at runtime. If that file is not found, Sugar loads the vardefs.php file, located in your module's directory. The same is true for language files. This caching also includes data for custom fields and any vardef or language extensions that are dropped into the extension framework.
Cache Files
./cache/modules/<module>/<object_name>vardefs.php
./cache/modules/<module>/languages/en_us.lang.php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
ae62739d3063-5
|
./cache/modules/<module>/languages/en_us.lang.php
TopicsSugarBean$bean = BeanFactory::retrieveBean($module, $id);BeanFactoryThe BeanFactory class, located in ./data/BeanFactory.php, is used for loading an instance of a SugarBean. This class should be used any time you are creating or retrieving bean objects. It will automatically handle any classes required for the bean.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/index.html
|
bf82603a3677-0
|
SugarBean
//Retrieve bean
$bean = BeanFactory::retrieveBean($module, $id);
//Set deleted to true
$bean->mark_deleted($bean->id);
//Save
$bean->save();
Overview
The SugarBean class supports all the model operations to and from the database. Any module that interacts with the database utilizes the SugarBean class, which contains methods to create, read/retrieve, update, and delete records in the database (CRUD), as well as fetch related records.
CRUD Handling
The SugarBean handles the most basic functions of the Sugar database, allowing you to create, retrieve, update, and delete data.Â
Creating and Retrieving Records
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-1
|
Creating and Retrieving Records
The BeanFactory class is used for bean loading. The class should be used whenever you are creating or retrieving bean objects. It will automatically handle any classes required for the bean. More information on this can be found in the BeanFactory section.
Obtaining the Id of a Recently Saved Bean
For new records, a GUID is generated and assigned to the record id field. Saving new or existing records returns a single value to the calling routine, which is the id attribute of the saved record. The id has the following format:
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
You can retrieve a newly created record's id with the following:
//Create bean
$bean = BeanFactory::newBean($module);
//Populate bean fields
$bean->name = 'Example Record';
//Save
$bean->save();
//Retrieve the bean id
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-2
|
//Save
$bean->save();
//Retrieve the bean id
$record_id = $bean->id;
Saving a Bean with a Specific ID
Saving a record with a specific id requires the id and new_with_id attribute of the bean to be set. When doing so, it is important that you use a globally unique identifier. Failing to do so may result in unexpected behavior in the system. An example setting an id is shown below:
//Create bean
$bean = BeanFactory::newBean($module);
//set the new flag
$bean->new_with_id = true;
//Set the record id with a static id
$id = '38c90c70-7788-13a2-668d-513e2b8df5e1';
$bean->id = $id;
//or have the system generate an id for you
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-3
|
$bean->id = $id;
//or have the system generate an id for you
//$id = Sugarcrm\Sugarcrm\Util\Uuid::uuid1()
//$bean->id = $id;
//Populate bean fields
$bean->name = 'Example Record';
//Save
$bean->save();
Setting new_with_id to true prevents the save method from creating a new id value and uses the assigned id attribute. If the id attribute is empty and the new_with_id attribute is set to true, the save will fail. If you would like for the system to generate an id for you, you can use Sugarcrm\Sugarcrm\Util\Uuid::uuid1().
Distinguishing New from Existing Records
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-4
|
Distinguishing New from Existing Records
To identify whether or not a record is new or existing, you can check the fetched_rows property. If the $bean has a fetched_row, it was loaded from the database. An example is shown below:
if (!isset($bean->fetched_row['id'])) {
//new record
} else {
//existing record
}
If you are working with a logic hook such as before_save or after_save, you should check the arguments.isUpdate property to determine this as shown below:
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function hook_method($bean, $event, $arguments)
{
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-5
|
function hook_method($bean, $event, $arguments)
{
if (isset($arguments['isUpdate']) && $arguments['isUpdate'] == false) {
//new record
} else {
//existing record
}
}
}
?>
Retrieving a Bean by Unique Field
Sometimes developers have a need to fetch a record based on a unique field other than the id. In previous versions you were able to use the retrieve_by_string_fields() method to accomplish this, however, that has now been deprecated. To search and fetch records, you should use the SugarQuery builder. An example of this is shown below:
require_once('include/SugarQuery/SugarQuery.php');
$sugarQuery = new SugarQuery();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-6
|
$sugarQuery = new SugarQuery();
//fetch the bean of the module to query
$bean = BeanFactory::newBean('<modules>');
//create first query
$sql = new SugarQuery();
$sql->select('id');
$sql->from($bean);
$sql->Where()->equals('<field>', '<unique value>');
$result = $sql->execute();
$count = count($result);
if ($count == 0) {
//no results were found
} elseif ($count == 1) {
//one result was found
$bean = BeanFactory::getBean('<module>', $result[0]['id']);
} else {
//multiple results were found
}
Updating a Bean
You can update a bean by fetching a record and then updating the property:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-7
|
You can update a bean by fetching a record and then updating the property:
//Retrieve bean
$bean = BeanFactory::retrieveBean($module, $id);
//Fields to update
$bean->name = 'Updated Name';
//Save
$bean->save();
Note: Disabling row-level security when accessing a bean should be set to true only when it is absolutely necessary to bypass security, for example, when updating a Lead record from a custom Entry Point. An example of accessing the bean while bypassing row security is:
$bean = BeanFactory::retrieveBean($module, $record_id, array('disable_row_level_security' => true));
Updating a Bean Without Changing the Date Modified
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-8
|
Updating a Bean Without Changing the Date Modified
The SugarBean class contains an attribute called update_date_modified, which is set to true when the class is instantiated and means that the date_modified attribute is updated to the current database date timestamp. Setting update_date_modified to false would result in the date_modified attribute not being set with the current database date timestamp.
//Retrieve bean
$bean = BeanFactory::retrieveBean($module, $id);
//Set modified flag
$bean->update_date_modified = false;
//Fields to update
$bean->name = 'Updated Name';
//Save
$bean->save();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-9
|
$bean->name = 'Updated Name';
//Save
$bean->save();
Note: Disabling row-level security when accessing a bean should be set to true only when it is absolutely necessary to bypass security, for example, when updating a Lead record from a custom Entry Point. An example of accessing the bean while bypassing row security is:
$bean = BeanFactory::retrieveBean($module, $record_id, array('disable_row_level_security' => true));
Deleting a Bean
Deleting a bean can be done by fetching it then calling the mark_deleted() method which makes sure any relationships with related records are removed as well:
//Retrieve bean
$bean = BeanFactory::retrieveBean($module, $id);
//Set deleted to true
$bean->mark_deleted($id);
//Save
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-10
|
//Set deleted to true
$bean->mark_deleted($id);
//Save
$bean->save();
Note: Disabling row-level security when accessing a bean should be set to true only when it is absolutely necessary to bypass security, for example, when updating a Lead record from a custom Entry Point. An example of accessing the bean while bypassing row security is:
$bean = BeanFactory::retrieveBean($module, $record_id, array('disable_row_level_security' => true));
Fetching Relationships
This section explains how the SugarBean class can be used to fetch related information from the database.
Fetching Related Records
To fetch related records, load the relationship using the link:
//If relationship is loaded
if ($bean->load_relationship($link)) {
//Fetch related beans
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-11
|
if ($bean->load_relationship($link)) {
//Fetch related beans
$relatedBeans = $bean->$link->getBeans();
}
An example of this is to load the contacts related to an account:
//Load Account
$bean = BeanFactory::getBean('Accounts', $id);
//If relationship is loaded
if ($bean->load_relationship('contacts')) {
//Fetch related beans
$relatedBeans = $bean->contacts->getBeans();
}
Fetching Related Record IDs
To fetch only related record IDs, load the relationship using the link:
//If relationship is loaded
if ($bean->load_relationship($link)) {
//Fetch related record IDs
$relatedBeans = $bean->$link->get();
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-12
|
$relatedBeans = $bean->$link->get();
}
An example of this is to load the record IDs of contacts related to an account:
//Load Account
$bean = BeanFactory::getBean('Accounts', $id);
//If relationship is loaded
if ($bean->load_relationship('contacts')) {
//Fetch related beans
$relatedBeans = $bean->contacts->get();
}
Fetching a Parent Record
Fetching a parent record is similar to fetching child records in that you will still need to load the relationship using the link:
//If relationship is loaded
if ($bean->load_relationship($link)) {
//Fetch related beans
$relatedBeans = $bean->$link->getBeans();
$parentBean = false;
if (!empty($relatedBeans)) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-13
|
$parentBean = false;
if (!empty($relatedBeans)) {
//order the results
reset($relatedBeans);
//first record in the list is the parent
$parentBean = current($relatedBeans);
}
}
An example of this is to load a contact and fetch its parent account:
//Load Contact
$bean = BeanFactory::getBean('Contacts', $id);
//If relationship is loaded
if ($bean->load_relationship('accounts')) {
//Fetch related beans
$relatedBeans = $bean->accounts->getBeans();
$parentBean = false;
if (!empty($relatedBeans)) {
//order the results
reset($relatedBeans);
//first record in the list is the parent
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
bf82603a3677-14
|
reset($relatedBeans);
//first record in the list is the parent
$parentBean = current($relatedBeans);
}
}
TopicsCustomizing Core SugarBeansThis article covers how to extend core SugarBean objects to implement custom code. This can be used to alter the stock assignment notification message or to add logic to change the default modules behavior.Implementing Custom SugarBean TemplatesThis article covers how to implement custom SugarBean templates, which can then be extended by custom modules. It also covers vardef templates, which can more portable and used by multiple modules. By default, Sugar comes with a few templates such as Company, Person, Issue, and File templates.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/index.html
|
c91a5b84b54a-0
|
Implementing Custom SugarBean Templates
Overview
This article covers how to implement custom SugarBean templates, which can then be extended by custom modules. It also covers vardef templates, which can more portable and used by multiple modules. By default, Sugar comes with a few templates such as Company, Person, Issue, and File templates.
Creating a Custom SugarBean Template
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-1
|
Creating a Custom SugarBean Template
The following example will create a custom Bean template that can be used by custom modules to shrink down the overall size of the Bean model, by only implementing the two fields required by all modules, the id field and the deleted field. In order to do this, we will have to override some core SugarBean methods, as the base SugarBean is statically configured to do things like Save/Delete the model with the date_entered, date_modified, modified_user_id and created_user_id fields. In order to accommodate custom Beans that wish to use those fields, this template will also have properties for configuring those types of fields so that they are populated using the default SugarBean logic.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-2
|
To create a template for use by custom modules, you create a class that extends from SugarBean in ./custom/include/SugarObjects/templates/<template_name>/<class_name>.php. For this example, we will create the "bare" template with the following file:
./custom/include/SugarObjects/templates/bare/BareBean.php
<?php
class BareBean extends SugarBean
{
/**
* The configured modified date field
* @var string|false
*/
protected $_modified_date_field = false;
/**
* The configured modified user field
* @var string|false
*/
protected $_modified_user_field = false;
/**
* The configured created date field
* @var string|false
*/
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-3
|
* The configured created date field
* @var string|false
*/
protected $_created_date_field = false;
/**
* The configured created user field
* @var string|false
*/
protected $_created_user_field = false;
/**
* Get the field name where modified date is stored, if in use by Module
* @return string|false
*/
public function getModifiedDateField()
{
if ($this->_modified_date_field !== FALSE){
$field = $this->_modified_date_field;
if (isset($this->field_defs[$field]) && $this->field_defs[$field]['type'] == 'datetime'){
return $field;
}
}
return FALSE;
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-4
|
return $field;
}
}
return FALSE;
}
/**
* Override the stock setModifiedDate method
* - Check that field is in use by this Module
* - If in use, set the configured field to current time
* @inheritdoc
**/
public function setModifiedDate($date = '')
{
global $timedate;
$field = $this->getModifiedDateField();
if ($field !== FALSE){
// This code was duplicated from the stock SugarBean::setModifiedDate
if ($this->update_date_modified || empty($this->$field)) {
// This only needs to be calculated if it is going to be used
if (empty($date)) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-5
|
if (empty($date)) {
$date = $timedate->nowDb();
}
$this->$field = $date;
}
}
}
/**
* Get the field name where modified user ID is stored, if in use by Module
* @return string|false
**/
public function getModifiedUserField()
{
if ($this->_modified_user_field !== FALSE){
$field = $this->_modified_user_field;
if (isset($this->field_defs[$field]) && $this->field_defs[$field]['type'] == 'assigned_user_name'){
return $field;
}
}
return FALSE;
}
/**
* Override the stock setModifiedUser Method
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-6
|
}
/**
* Override the stock setModifiedUser Method
* - Check that field is in use by this Module
* - If in use, set the configured field to user_id
* @inheritdoc
* @param User|null $user [description]
*/
public function setModifiedUser(User $user = null)
{
global $current_user;
$field = $this->getModifiedUserField();
if ($field !== FALSE){
// If the update date modified by flag is set then carry out this directive
if ($this->update_modified_by) {
// Default the modified user id to the default
$this->$field = 1;
// If a user was not presented, default to the current user
if (empty($user)) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-7
|
if (empty($user)) {
$user = $current_user;
}
// If the user is set, use it
if (!empty($user)) {
$this->$field = $user->id;
}
}
}
}
/**
* Get the field name where created date is stored, if in use by Module
* @return string|false
*/
public function getCreatedDateField()
{
if ($this->_created_date_field !== FALSE){
$field = $this->_created_date_field;
if (isset($this->field_defs[$field]) && $this->field_defs[$field]['type'] == 'datetime'){
return $field;
}
}
return FALSE;
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-8
|
return $field;
}
}
return FALSE;
}
/**
* Get the field name where created user ID is stored, if in use by Module
* @return string|false
*/
public function getCreatedUserField()
{
if ($this->_created_user_field !== FALSE){
$field = $this->_created_user_field;
if (isset($this->field_defs[$field]) && $this->field_defs[$field]['type'] == 'assigned_user_name'){
return $field;
}
}
return FALSE;
}
/**
* Override the stock setCreateData method
* - Code was duplicated from stock, to accommodate not having created date or created user fields
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-9
|
* @inheritdoc
*/
public function setCreateData($isUpdate, User $user = null)
{
if (!$isUpdate) {
global $current_user;
$field = $this->getCreatedDateField();
if ($field !== FALSE){
//Duplicated from SugarBean::setCreateData with modifications for dynamic field name
if (empty($this->$field)) {
$this->$field = $this->getDateModified();
}
if (empty($this->$field)){
global $timedate;
$this->$field = $timedate->nowDb();
}
}
$field = $this->getCreatedUserField();
if ($field !== FALSE){
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-10
|
if ($field !== FALSE){
//Duplicated from SugarBean::setCreateData with modifications for dynamic field name
if ($this->set_created_by == true) {
// created by should always be this user
// unless it was set outside of the bean
if ($user) {
$this->$field = $user->id;
} else {
$this->$field = isset($current_user) ? $current_user->id : "";
}
}
}
if ($this->new_with_id == false) {
$this->id = Sugarcrm\Sugarcrm\Util\Uuid::uuid1();
}
}
}
/**
* Get the Date Modified fields value
* @return mixed|false
*/
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-11
|
* Get the Date Modified fields value
* @return mixed|false
*/
public function getDateModified()
{
if ($this->_modified_date_field !== FALSE){
$field = $this->_modified_date_field;
return $this->$field;
}
return FALSE;
}
/**
* Get the Date Created Fields value
* @return mixed|false
*/
public function getDateCreated()
{
if ($this->_created_date_field !== FALSE){
$field = $this->_created_date_field;
return $this->$field;
}
return FALSE;
}
/**
* @inheritdoc
*/
public function mark_deleted($id)
{
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-12
|
*/
public function mark_deleted($id)
{
$date_modified = $GLOBALS['timedate']->nowDb();
if (isset($_SESSION['show_deleted'])) {
$this->mark_undeleted($id);
} else {
// Ensure that Activity Messages do not occur in the context of a Delete action (e.g. unlink)
// and do so for all nested calls within the Top Level Delete Context
$opflag = static::enterOperation('delete');
$aflag = Activity::isEnabled();
Activity::disable();
// call the custom business logic
$custom_logic_arguments['id'] = $id;
$this->call_custom_logic("before_delete", $custom_logic_arguments);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-13
|
$this->deleted = 1;
if (isset($this->field_defs['team_id'])) {
if (empty($this->teams)) {
$this->load_relationship('teams');
}
if (!empty($this->teams)) {
$this->teams->removeTeamSetModule();
}
}
$this->mark_relationships_deleted($id);
$updateFields = array('deleted' => 1);
$field = $this->getModifiedDateField();
if ($field !== FALSE){
$this->setModifiedDate();
$updateFields[$field] = $this->$field;
}
$field = $this->getModifiedUserField();
if ($field !== FALSE){
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-14
|
if ($field !== FALSE){
$this->setModifiedUser();
$updateFields[$field] = $this->$field;
}
$this->db->updateParams(
$this->table_name,
$this->field_defs,
$updateFields,
array('id' => $id)
);
if ($this->isFavoritesEnabled()) {
SugarFavorites::markRecordDeletedInFavorites($id, $date_modified);
}
// Take the item off the recently viewed lists
$tracker = BeanFactory::newBean('Trackers');
$tracker->makeInvisibleForAll($id);
SugarRelationship::resaveRelatedBeans();
// call the custom business logic
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-15
|
SugarRelationship::resaveRelatedBeans();
// call the custom business logic
$this->call_custom_logic("after_delete", $custom_logic_arguments);
if(static::leaveOperation('delete', $opflag) && $aflag) {
Activity::enable();
}
}
}
/**
* @inheritdoc
*/
public function mark_undeleted($id)
{
// call the custom business logic
$custom_logic_arguments['id'] = $id;
$this->call_custom_logic("before_restore", $custom_logic_arguments);
$this->deleted = 0;
$modified_date_field = $this->getModifiedDateField();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-16
|
$modified_date_field = $this->getModifiedDateField();
if ($modified_date_field !== FALSE){
$this->setModifiedDate();
}
$query = "UPDATE {$this->table_name} SET deleted = ?".(!$modified_date_field?"":",$modified_date_field = ?")." WHERE id = ?";
$conn = $this->db->getConnection();
$params = array($this->deleted);
if ($modified_date_field){
$params[] = $this->$modified_date_field;
}
$params[] = $id;
$conn->executeQuery($query, $params);
// call the custom business logic
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
c91a5b84b54a-17
|
// call the custom business logic
$this->call_custom_logic("after_restore", $custom_logic_arguments);
}
}
With the Bean template in place, we can define the default vardefs for the template by creating the following file:
./custom/include/SugarObjects/templates/bare/vardefs.php
<?php
$vardefs = array(
'audited' => false,
'favorites' => false,
'activity_enabled' => false,
'fields' => array(
'id' => array(
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => true,
'reportable' => true,
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Models/SugarBean/Implementing_Custom_SugarBean_Templates/index.html
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.