# Record Layout

GridMate provides a lightning component **GM - Record Layout**  to display record details or any related parent using a layout configuration.

In this tutorial, we will configure the **GM - Record Layout** component to display the sponsor details on the Opportunity page.

1. Select an opportunity record and edit the page in the Lightning App Builder.
2. From the components list, drag and drop the component **GM - Record Layout**.
3. The component is now ready for configuration in the Lightning App Builder.
4. To perform a quick configuration, populate required property values:
   * Object Name : **Contact**.
   * Record Id Field : **Sponsor\_\_c**.
   * Show Border : **Checked**.
   * Record Layout : See [Layout Configuration](#layout-configuration)
   * Record Actions : See [Actions Configuration](#actions-configuration)

\
Below is a step by step tutorial to configure the **GM - Record Layout** component.

{% embed url="<https://youtu.be/PZ7qloBWR8o>" %}

{% hint style="info" %}
To display information based on the related record, ensure that those fields are displayed on a separate GM - Record Layout.
{% endhint %}

### Layout Configuration

{% code lineNumbers="true" %}

```coffeescript
{
    "sections": [
        {
            "name": "contactInformation",
            "label": "Contact Information",
            "active": true,
            "cols": 3,
            "rows": [
                [{"apiName": "Name"}],
                [
                    {"apiName": "ReportsToId"},
                    {"apiName": "MailingStreet"},
                    {
                        "apiName": "MailingCountry",
                        "coloring": [
                            {
                                "color": "#a6f79e",
                                "exp": {
                                    "MailingCountry": {
                                        "operator": "=",
                                        "value": "USA"
                                    }
                                }
                            }
                        ]
                    }
                ],
                [
                    {
                        "apiName": "MailingCity",
                        "autocomplete": [
                            "Paris",
                            "New York",
                            "London",
                            "Rome"
                        ],
                        "noWhitespace": true
                    }
                ],
                [
                    {"apiName": "OwnerId"},
                    {"apiName": "LeadSource"},
                    {
                        "apiName": "Title",
                        "readOnly": {
                            "Title": {
                                "operator": "in",
                                "value": ["Other"]
                            }
                        }
                    }
                ],
                [
                    {"apiName": "Level__c"},
                    {"apiName": "CLevel__c"}
                ],
                [
                    {
                        "apiName": "Salary__c",
                        "required": false
                    }
                ],
                [
                    {
                        "apiName": "CreatedById",
                        "noWhitespace": true
                    }
                ],
                [
                    {
                        "apiName": "LastModifiedById",
                        "noWhitespace": true
                    }
                ],
                [
                    {
                        "apiName": "Notes__c",
                        "noWhitespace": true
                    }
                ],
                [
                    {
                        "apiName": "RecordTypeId",
                        "noWhitespace": true
                    }
                ]
            ]
        }
    ]
}
```

{% endcode %}

### Actions Configuration

{% code lineNumbers="true" %}

```coffeescript
[
    {
        "name": "Contact.Update_Status",
        "icon": "utility:close",
        "label": "Status",
        "visibility": {
            "Approval_Status__c": {
                "operator": "!=",
                "value": "Accepted"
            }
        }
    },
    {
        "label": "Open",
        "name": "open",
        "icon": "utility:new_window",
        "event": {
            "name": "e.force:navigateToSObject",
            "params": {}
        }
    }
]
```

{% endcode %}
