GM - Record Layout

(gmpkg:RecordLayoutComponent)

Documentation

GM - Record Layout component is used to display a related object using a layout configuration. The related object could be at any level. You can configure this component to display sections and define also their visibilities.

Use case: Display the ultimate account details on the contact page with different sections and of course more than 2 columns!

Specification

Record Layout Schema

Each section contains a list of rows. A section could have a visibility condition that can evaluate all the properties of the targeted record(see example below).

A section has these properties:

  • name: the name of the section. It should be unique

  • label: the title of the section

  • active: a flag to activate the section or not. Set this field to always to keep the section always active

  • cols: # of columns to display.

  • visibility: visibility condition. It should be built it the same way as Read-only Fields

  • readOnly: Read-only condition. It should be built it the same way as Read-only Fields. If the section is read-only, all its fields will be read-only as well

  • rows: the list of rows. Each row is a list of fields or blocks to display

Each row contains a list of fields or an empty block. Each field can be displayed in a read-only using a condition that can evaluate all the properties of the targeted record (see example below).

A field has these properties:

  • apiName: the API name of the field.

  • colSize: the width of the component

  • noWhitespace: flag to remove white space

  • emtyBlock: An empty block ({"emtyBlock": true}) can be used to align to the displayed fields

  • readOnly: Read-only condition. It should be built it the same way as Read-only Fields

  • visibility: visibility condition. It should be built it the same way as Read-only Fields

  • coloring: Conditions for coloring. You can define the coloring and the corresponding condition same as Cell Coloring for Grids.

    [
        {
            "color": "#a6f79e",
            "exp": {
                "MailingCity": {
                    "operator": "=",
                    "value": "Paris"
                }
            }
        }
    ]
  • managedComponent: set to true if you want to use a custom component to display the field.

  • componentDef: Custom component to use for the managed field. This property is a JSON object containing the component name and attributes.

We can also override the density of the record layout using the density property (see example below). This property could be set to "auto" | "compact" | "compact"

Parent fields can be used for Visibility and ReadOnly conditions. See the example below:

{
    "sections": [
        {
            "name": "ssnInformation",
            "label": "SSN",
            "active": true,
            "cols": 1,
            "rows": [               
                [
                    {
                        "apiName": "SSN__c",
                        "visibility": {
                            "Account.BillingCountry": {
                                "operator": "=",
                                "value": "USA"
                            }
                        }
                    }
                ]
            ]
        }
    ]
}

Configuration Examples

API Reference

<design:component label="GM - Record Layout">    
    <design:attribute name="recordId" label="recordId" 
                      description="recordId to use. Use it only for community"/>        
    <design:attribute name="targetObjName" label="Object Name" 
                      description="Object Name to load"/>    
    <design:attribute name="recordIdField" label="Record Id Field" 
                      description="Record Id Field to load" />
    <design:attribute name="recordLayout" label="Record Layout" 
                      description="JSON Record Layout"/>    
    <design:attribute name="showBorder" label="Show Border" 
                      description="Show record card border"/>
    
    <design:attribute name="recordActions" label="Record Actions" 
                      description="JSON Record Actions"/>        
    <design:attribute name="buttonActions" label="Show Actions as Buttons" 
                      description="Use buttons for actions instead of icons"/>
    <design:attribute name="visibleActions" label="Visible Actions" 
                      description="# of visible actions"/> 
</design:component>

Last updated