Let the platform do the work

Metadata

Overview

This page is an overview of the metadata framework for Sidecar modules.

View Metadata Framework

A module's view-specific metadata can be found in the modules view file:

./modules/<module>/clients/<client>/views/<view>/<view>.php

Any edits made in Admin > Studio will be reflected in the file:

./custom/modules/<module>/clients/<client>/views/<view>/<view>.php

Note: The Sugar application's client type is "base". For more information on the various client types, please refer to the User Interface page.

Note: In the case of metadata, custom view metadata files are respected over the stock view metadata files.

View Metadata

The Sidecar views metadata is very similar to that of the MVC metadata, however, there are some basic differences. All metadata for Sidecar follows the format:

  $viewdefs['<module>']['base']['view']['<view>'] = array();

Note: The following array illustrates view metadata structure. It is not the complete stock Accounts layout for Sugar 26.2. When Multiple Shipping Addresses is enabled, the Account shipping fields shown in this example are replaced by the Shipping Addresses subpanel; Studio cannot restore those legacy fields while the feature is enabled.

An example of this is the account's record layout shown below:

./modules/Accounts/clients/base/views/record/record.php

  <?php

$viewdefs['Accounts']['base']['view']['record'] = array(
    'panels' => array(
        array(
            'name' => 'panel_header',
            'header' => true,
            'fields' => array(
                array(
                    'name'          => 'picture',
                    'type'          => 'avatar',
                    'width'         => 42,
                    'height'        => 42,
                    'dismiss_label' => true,
                    'readonly'      => true,
                ),
                'name',
                array(
                    'name' => 'favorite',
                    'label' => 'LBL_FAVORITE',
                    'type' => 'favorite',
                    'dismiss_label' => true,
                ),
                array(
                    'name' => 'follow',
                    'label'=> 'LBL_FOLLOW',
                    'type' => 'follow',
                    'readonly' => true,
                    'dismiss_label' => true,
                ),
            )
        ),
        array(
            'name' => 'panel_body',
            'columns' => 2,
            'labelsOnTop' => true,
            'placeholders' => true,
            'fields' => array(
                'website',
                'industry',
                'parent_name',
                'account_type',
                'assigned_user_name',
                'phone_office',
            ),
        ),
        array(
            'name' => 'panel_hidden',
            'hide' => true,
            'columns' => 2,
            'labelsOnTop' => true,
            'placeholders' => true,
            'fields' => array(
                array(
                    'name' => 'fieldset_address',
                    'type' => 'fieldset',
                    'css_class' => 'address',
                    'label' => 'Billing Address',
                    'fields' => array(
                        array(
                            'name' => 'billing_address_street',
                            'css_class' => 'address_street',
                            'placeholder' => 'LBL_BILLING_ADDRESS_STREET',
                        ),
                        array(
                            'name' => 'billing_address_city',
                            'css_class' => 'address_city',
                            'placeholder' => 'LBL_BILLING_ADDRESS_CITY',
                        ),
                        array(
                            'name' => 'billing_address_state',
                            'css_class' => 'address_state',
                            'placeholder' => 'LBL_BILLING_ADDRESS_STATE',
                        ),
                        array(
                            'name' => 'billing_address_postalcode',
                            'css_class' => 'address_zip',
                            'placeholder' => 'LBL_BILLING_ADDRESS_POSTALCODE',
                        ),
                        array(
                            'name' => 'billing_address_country',
                            'css_class' => 'address_country',
                            'placeholder' => 'LBL_BILLING_ADDRESS_COUNTRY',
                        ),
                    ),
                ),
                array(
                    'name' => 'fieldset_shipping_address',
                    'type' => 'fieldset',
                    'css_class' => 'address',
                    'label' => 'Shipping Address',
                    'fields' => array(
                        array(
                            'name' => 'shipping_address_street',
                            'css_class' => 'address_street',
                            'placeholder' => 'LBL_SHIPPING_ADDRESS_STREET',
                        ),
                        array(
                            'name' => 'shipping_address_city',
                            'css_class' => 'address_city',
                            'placeholder' => 'LBL_SHIPPING_ADDRESS_CITY',
                        ),
                        array(
                            'name' => 'shipping_address_state',
                            'css_class' => 'address_state',
                            'placeholder' => 'LBL_SHIPPING_ADDRESS_STATE',
                        ),
                        array(
                            'name' => 'shipping_address_postalcode',
                            'css_class' => 'address_zip',
                            'placeholder' => 'LBL_SHIPPING_ADDRESS_POSTALCODE',
                        ),
                        array(
                            'name' => 'shipping_address_country',
                            'css_class' => 'address_country',
                            'placeholder' => 'LBL_SHIPPING_ADDRESS_COUNTRY',
                        ),
                        array(
                            'name' => 'copy',
                            'label' => 'NTC_COPY_BILLING_ADDRESS',
                            'type' => 'copy',
                            'mapping' => array(
                                'billing_address_street' => 'shipping_address_street',
                                'billing_address_city' => 'shipping_address_city',
                                'billing_address_state' => 'shipping_address_state',
                                'billing_address_postalcode' => 'shipping_address_postalcode',
                                'billing_address_country' => 'shipping_address_country',
                            ),
                        ),
                    ),
                ),
                array(
                    'name' => 'phone_alternate',
                    'label' => 'LBL_OTHER_PHONE',
                ),
                'email',
                'phone_fax',
                'campaign_name',
                array(
                    'name' => 'description',
                    'span' => 12,
                ),
                'sic_code',
                'ticker_symbol',
                'annual_revenue',
                'employees',
                'ownership',
                'rating',
                array(
                    'name' => 'date_entered_by',
                    'readonly' => true,
                    'type' => 'fieldset',
                    'label' => 'LBL_DATE_ENTERED',
                    'fields' => array(
                        array(
                            'name' => 'date_entered',
                        ),
                        array(
                            'type' => 'label',
                            'default_value' => 'LBL_BY',
                        ),
                        array(
                            'name' => 'created_by_name',
                        ),
                    ),
                ),
                'team_name',
                array(
                    'name' => 'date_modified_by',
                    'readonly' => true,
                    'type' => 'fieldset',
                    'label' => 'LBL_DATE_MODIFIED',
                    'fields' => array(
                        array(
                            'name' => 'date_modified',
                        ),
                        array(
                            'type' => 'label',
                            'default_value' => 'LBL_BY',
                        ),
                        array(
                            'name' => 'modified_by_name',
                        ),
                    ),
                ),
            ),
        ),
    ),
);

The metadata for a given view can be accessed using app.metadata.getView within your controller. An example fetching the view metadata for the Accounts RecordView is shown below:

  app.metadata.getView('Accounts', 'record');

You should note that this can also be accessed in your browser's console window by using the global App Identifier:

  App.metadata.getView('Accounts', 'record');

Preserving Custom Layouts

The 26.2 default layouts for Leads, Accounts, and Contacts reorganize record, preview, record dashlet, list, popup, search, dashboard, and Focus Drawer content. Default or unmodified layouts receive the new definitions; customized layouts require deliberate incorporation of the desired fields and actions.

Record layouts use Overview and Record Information tabs in place of Business Card and Show More. List and search layouts surface the new interaction and opportunity dates. Default list dashboards use module-specific My Favorite and My Recently Viewed dashlets. Record dashboards emphasize Timeline, Planned Activities, and Active Tasks; Accounts also includes Opportunity Metrics and licensed AI Summary content.

Focus Drawers combine Record View, Timeline, and relevant related-record dashlets. Licensed AI Summary content has a designated full-width position for Accounts. An older upgrade path may append an absent AI Summary dashlet at the bottom; test upgraded dashboards separately from fresh defaults. Removed default dashlets remain available for manual addition.

Actions and Record Context

Log Activity provides Log a Call, Schedule a Call, Schedule a Meeting, Create a Note, and Create a Task on Leads, Accounts, Contacts, and Opportunities. The actions pre-populate the originating record context. The field is included on default/non-customized record views in Accounts, Contacts, and Leads. Add the button manually to customized layouts. The parent dropdown uses an auto-saving Update Record action, so clicking the parent button can update Date Modified even when no visible field changes.

The New Opportunity field is available on Accounts and Contacts and opens creation with Account context. The field is available on upgraded instances but hidden; enable it in Studio. Account is added automatically to unmodified Record View layouts for Calls, Meetings, Tasks, and Notes; this placement change does not imply corresponding changes to all mobile or list layouts.

Facebook and Twitter fields become URL fields; Twitter is labeled X (Twitter). Company Instagram and Company LinkedIn are added on Leads and Accounts. Existing values are preserved rather than normalized into valid URLs. Case creation also pre-populates Business Center from the related Account while retaining a user’s explicit selection.

For upgrades from a version earlier than 26.2.0, the New Opportunity upgrade script writes sugarfield_action_new_opportunity.php under custom/Extension/modules/Accounts/Ext/Vardefs/ and custom/Extension/modules/Contacts/Ext/Vardefs/. It overwrites a file with the same name. Review any existing extension at these paths before upgrading, then enable the button through Studio where required. The hidden state applies to upgraded instances with default layouts as well as customized layouts.

Topics