> For the complete documentation index, see [llms.txt](https://docs.gridmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gridmate.io/package-reference/components-library/grids/gm-mobile-grid.md).

# GM - Mobile Grid

(gmpkg:mobileGridLWC)

## **Documentation**

**GM - Mobile Grid** component is a touch-first grid for the Salesforce mobile app. Records are displayed as cards with a linked title, detail fields, an icon and an info button showing more fields. The toolbar offers refresh, search, quick filters, quick sort and a menu of mass actions. Cards can be grouped on several levels with totals, colored with conditions and selected for mass actions.

**Use case:** Display the opportunities of an account, grouped by stage with the total amount, on the account record page of the Salesforce mobile app. See [Mobile Grid](https://docs.gridmate.io/product-tour/grids/mobile-grid.md).

{% hint style="warning" %}
**GM - Mobile Grid** supports the **phone** form factor only. It is available on App, Record and Home pages when the Lightning App Builder is set to **Phone**, and it is not displayed on desktop. Use a phone-specific page and assign it to the **Phone** form factor.
{% endhint %}

{% hint style="info" %}
The JSON properties are validated when the component loads. An invalid value shows an error toast with the property name, and the component ignores that property.
{% endhint %}

## **Specification**

<table data-full-width="true"><thead><tr><th width="192.64501953125">Property</th><th width="104">Type</th><th width="515.0911865234375">Description</th></tr></thead><tbody><tr><td>Custom Label</td><td>String</td><td>Set the label of the mobile grid.</td></tr><tr><td>Custom Icon</td><td>String</td><td>Customize the mobile grid icon. The icon is displayed on each card. All Lightning icons are supported, for example <code>standard:opportunity</code>.</td></tr><tr><td>DataGrid Code</td><td>String</td><td>The code to identify the mobile grid. Reserved for future use.</td></tr><tr><td>Object Name</td><td>String</td><td>The name of the object to display on App and Home pages. Ex. <code>Opportunity</code></td></tr><tr><td>Target Object Name</td><td>String</td><td>The name of the object to display if the mobile grid is shown on a record page. Ex. <code>Opportunity</code></td></tr><tr><td>Title Field</td><td>String</td><td>The field used for the card title. The title links to the record.</td></tr><tr><td>Detail Fields</td><td>String</td><td><code>,</code> separated list of fields displayed on the card. Ex. <code>StageName,Amount,CloseDate</code></td></tr><tr><td>Popover Fields</td><td>String</td><td><code>,</code> separated list of additional fields displayed when the user taps the info button of a card.</td></tr><tr><td>Row Limit</td><td>Integer</td><td>The maximum number of rows to fetch.</td></tr><tr><td>Filter</td><td>String</td><td>JSON string to define filter criteria. On a record page, <code>$recordId</code> is replaced by the current record Id. Ex. <code>{"AccountId":"$recordId"}</code></td></tr><tr><td>Sort</td><td>String</td><td>The field list to sort the data. Ex. <code>CloseDate</code></td></tr><tr><td>Order</td><td>String</td><td>Asc or Desc order for sorting.</td></tr><tr><td>Group By</td><td>String</td><td><code>,</code> separated list of fields to group by. Each field adds a grouping level. Ex. <code>StageName,Type</code></td></tr><tr><td>Collapse Groups</td><td>Boolean</td><td>Check this option to collapse all groups by default. The default value is unchecked.</td></tr><tr><td>Aggregate</td><td>String</td><td>JSON string to define aggregate fields, shown for the grid and for each group. The component supports <code>sum</code>, <code>min</code>, <code>max</code> and <code>avg</code>. Ex. <code>{"Amount":"sum"}</code></td></tr><tr><td>Search Fields</td><td>String</td><td><code>,</code> separated search fields. The search box is displayed when this property is set. The search applies to the loaded cards.</td></tr><tr><td>Card Coloring</td><td>String</td><td>JSON conditions for card coloring. The label of each condition is displayed in the coloring legend. See <a href="#card-coloring">Card Coloring</a>.</td></tr><tr><td>Enable Update Object</td><td>Boolean</td><td>Check this option if you want to edit records from the card menu.</td></tr><tr><td>Enable Mass Update</td><td>Boolean</td><td>Check this option if you want to mass update the selected cards. Requires <strong>Enable Update Object</strong>.</td></tr><tr><td>Enable Delete Object</td><td>Boolean</td><td>Check this option if you want to delete records from the card menu.</td></tr><tr><td>Enable Mass Delete</td><td>Boolean</td><td>Check this option if you want to mass delete the selected cards. Requires <strong>Enable Delete Object</strong>.</td></tr><tr><td>Actions</td><td>String</td><td>JSON string to initialize the list of actions available from the toolbar menu, on the selected cards. See <a href="#actions">Actions</a>.</td></tr><tr><td>Record Actions</td><td>String</td><td>JSON string to initialize the list of actions available from the menu of each card. See <a href="#actions">Actions</a>.</td></tr><tr><td>Height</td><td>Integer</td><td>Fixed height in pixels with an inner scroll. Leave it empty to let the component grow with its content.</td></tr><tr><td>Show Border</td><td>Boolean</td><td>Check this option to show a border around the cards.</td></tr><tr><td>Density</td><td>String</td><td>Component density: comfy | compact. The default value is comfy.</td></tr></tbody></table>

{% hint style="info" %}
The update, delete, mass update and mass delete options are applied on top of the user access: they are displayed only when the user can update or delete the object. **Mass Update** edits the fields displayed on the card (title, detail and popover fields).
{% endhint %}

## **API Reference**

{% tabs fullWidth="true" %}
{% tab title="mobileGridLWC.js-meta.xml" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>65.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>GM - Mobile Grid</masterLabel>
    <description>GM - Mobile Grid</description>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__AppPage,lightning__RecordPage,lightning__HomePage">
            <property
                name="displayLabel"
                type="String"
                label="Custom Label"
                description="Set the label of the mobile grid"
            />
            <property
                name="customIcon"
                type="String"
                label="Custom Icon"
                description="Customize the mobile grid icon. All lightning icons are supported. You can get the icon name from https://lightningdesignsystem.com/icons/"
            />
            <property
                name="gridCode"
                type="String"
                label="DataGrid Code"
                description="The code to identify the DataGrid"
            />
            <property
                name="objectApiName"
                type="String"
                label="Object Name"
                description="The name of the object to display. Ex. Opportunity"
            />
            <property
                name="sobjectName"
                type="String"
                label="Target Object Name"
                description="The name of the object to display if the mobile grid is displayed on a record page. Ex. Opportunity."
            />
            <property
                name="titleField"
                type="String"
                label="Title Field"
                description="The title field to use for the card title"
            />
            <property
                name="jsonObjectFields"
                type="String"
                label="Detail Fields"
                description="',' separated list of detail fields"
            />
            <property
                name="jsonPopoverFields"
                type="String"
                label="Popover Fields"
                description="Additional fields displayed in the card popover"
            />
            <property
                name="rowLimit"
                type="Integer"
                label="Row Limit"
                description="The maximum number of row to fetch"
            />
            <property
                name="filterBy"
                type="String"
                label="Filter"
                description="Json string to define filter criteria. Don’t forget __c for custom fields. Ex. {'StageName':'Needs Analysis'} to see only 'Needs Analysis' Opportunities. On record pages $recordId is replaced by the current record Id. Ex. {'AccountId':'$recordId'}"
            />
            <property
                name="sortBy"
                type="String"
                label="Sort"
                description="The field list to sort the data. Don’t forget __c for custom fields. Ex. Amount to sort opportunities by amount"
            />
            <property name="orderBy" type="String" label="Order" description="Asc or Desc order for sorting" />
            <property
                name="groupBy"
                type="String"
                label="Group By"
                description="',' separated list of fields to group by"
            />
            <property
                name="canUpdate"
                type="Boolean"
                label="Enable Update Object"
                description="Check this option if you want to update object"
            />
            <property
                name="canMassUpdate"
                type="Boolean"
                label="Enable Mass Update"
                description="Check this option if you want to mass update"
            />
            <property
                name="canDelete"
                type="Boolean"
                label="Enable Delete Object"
                description="Check this option if you want to delete object"
            />
            <property
                name="canMassDelete"
                type="Boolean"
                label="Enable Mass Delete"
                description="Check this option if you want to mass delete"
            />
            <property
                name="jsonAggregate"
                type="String"
                label="Aggregate"
                description="Json string to define aggregate fields. Ex. {'Amount':'sum'} to sum the amount of opportunities"
            />
            <property
                name="jsonActions"
                type="String"
                label="Actions"
                description="Json string to initialize the list of available actions"
            />
            <property
                name="collapseGroups"
                type="Boolean"
                label="Collapse Groups"
                description="Collapse all accordion groups by default. When unchecked, groups are expanded by default."
                default="false"
            />
            <property
                name="jsonRecordActions"
                type="String"
                label="Record Actions"
                description="Json string to initialize the list of available record actions"
            />
            <property
                name="jsonCardColoring"
                type="String"
                label="Card Coloring"
                description="JSON conditions for cards coloring"
            />
            <property
                name="jsonSearchFields"
                type="String"
                label="Search Fields"
                description="',' separated search fields"
            />
            <property
                name="height"
                type="Integer"
                label="Height"
                description="Fixed height in pixels with an inner scroll. Leave empty to let the component grow with its content."
            />
            <property name="showBorder" type="Boolean" label="Show Border" description="Show Border" />
            <property name="density" type="String" label="Density" description="Component density : comfy | compact" />

            <supportedFormFactors>
                <supportedFormFactor type="Small" />
            </supportedFormFactors>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
```

{% endtab %}
{% endtabs %}

## Card Coloring

**Card Coloring** is a JSON list of conditions. The first condition that matches a record sets the background of its card. The `label` of each condition is listed in the coloring legend.

```json
[
    {
        "label": "Closed Won",
        "color": "#C0F0B5",
        "exp": {
            "StageName": {
                "operator": "=",
                "value": "Closed Won"
            }
        }
    },
    {
        "label": "Big deal (> 100K)",
        "color": "#FFF1C2",
        "exp": {
            "Amount": {
                "operator": ">",
                "value": 100000
            }
        }
    }
]
```

## Actions

**Actions** run on the selected cards from the toolbar menu. **Record Actions** run on one card from its menu. Both properties use the same JSON format, and each action supports three types:

* **Quick action**: set `name` to the quick action API name.
* **Flow**: set `component` to `gmpkg/dataGridCallFlowLWC` and the flow name in `attributes`.
* **Navigation**: set `navigate` to a page reference. The object name and the record Id(s) are added to its `attributes`.

```json
[
    {
        "label": "Update Stage",
        "name": "Opportunity.Update_Stage"
    },
    {
        "label": "Close Lost",
        "name": "closeLost",
        "component": "gmpkg/dataGridCallFlowLWC",
        "attributes": {
            "flowName": "Opportunity_Close_Lost"
        }
    },
    {
        "label": "Open List View",
        "name": "openListView",
        "navigate": {
            "type": "standard__objectPage",
            "attributes": {
                "actionName": "list"
            }
        }
    }
]
```

For the flow input variables and the other action options, see [Grid - Mass/Record Actions](https://docs.gridmate.io/advanced-guides/grid-actions/actions-library.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gridmate.io/package-reference/components-library/grids/gm-mobile-grid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
