logo
search
list

Table of Content

Understanding the Group Properties JSON Hierarchy
Step-by-Step Configuration for Group Headers
Applying Conditional Logic to Grouped Data
Using WPS Office to Draft and Document JSON Scripts
FAQs

How to Reference @group.fieldData in SharePoint List View JSON

Posted by Chanuka Geekiyanage

calendar

2026-09-08

views

869

likes

4

When organizing large datasets in modern SharePoint sites, grouping items by specific categories makes navigation significantly easier for your users. By default, SharePoint displays these group headers in a standard, unformatted layout. However, if you want to apply custom background colors, dynamic icons, or specific layouts to these headers, you must use view formatting. A common hurdle developers and site administrators face during this customization is extracting the actual text of the grouped category. To achieve this, you need to understand exactly reference @group.fieldData in SharePoint List View JSON. This specific property accesses the underlying data of the grouped column, allowing you to build highly customized, dynamic headers that respond accurately to your list data.

Understanding the Group Properties JSON Hierarchy

Before writing your script, you must understand the architectural hierarchy of view formatting. Customizing a grouped view requires targeting a specific object within the JSON schema called groupProps. The groupProps object dictates how grouping behaves and looks, and it contains a nested object named headerFormatter. The headerFormatter is where you define the HTML elements (like containers or text spans) for the group header.

Inside this formatter, the @group object becomes available for use. It contains several properties, but the most important for data extraction is fieldData. Because fieldData is an object itself—not a plain text string—simply calling the parent property will not render the text. You must target the exact display property. Grasping this structural requirement is the most critical part of working to reference @group.fieldData in SharePoint List View JSON without generating syntax errors.

Step-by-Step Configuration for Group Headers

Illustrated steps for Reference @group.fieldData in SharePoint List View JSON
Key actions for Reference @group.fieldData in SharePoint List View JSON.

The core workflow for reference @group.fieldData in SharePoint List View JSON requires manipulating the Advanced mode formatting pane directly within your list view. Follow these sequential actions to apply your custom header:

  • Navigate to your target SharePoint list and ensure you have at least one column grouped. You can do this by clicking a column header and selecting Group by [Column Name].
  • Click the View options dropdown menu located at the top right of the command bar (usually displaying the current view name, like "All Items").
  • Select Format current view from the dropdown menu.
  • At the bottom of the formatting pane that appears on the right side of your screen, click the Advanced mode link.
  • Delete any existing JSON in the text area and construct your new schema.

You will need to input the exact JSON syntax to target the display value. Type the following structure into the editor:

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"headerFormatter": {
"elmType": "div",
"txtContent": "=@group.fieldData.displayValue"
}
}
}

Once you have entered this code, click the Save button at the bottom of the pane. Verify your setup by checking the list interface; the group headers should now display the actual category name as a plain text string inside a div, rather than remaining blank or showing a system identifier.

Applying Conditional Logic to Grouped Data

When configuring reference @group.fieldData in SharePoint List View JSON for complex lists, you will likely want to add conditional formatting based on the specific group name. Because you can extract the string using @group.fieldData.displayValue, you can write operators to check its value. For instance, if you are grouping by a "Status" column and want the header to turn red when the status is "Delayed", you can evaluate the field data directly.

To implement this, you add a style object inside your headerFormatter and use a ternary operator within the background-color property. The expression would look like: "=if(@group.fieldData.displayValue == 'Delayed', '#ff0000', '#ffffff')". By evaluating the precise output of the field data, your list automatically highlights critical groups, drastically improving the visual reporting capabilities of your SharePoint environment.

Using WPS Office to Draft and Document JSON Scripts

WPS Office options related to Reference @group.fieldData in SharePoint List View JSON
How WPS Office can support related document work.

While practicing reference @group.fieldData in SharePoint List View JSON, writing code directly into the browser's narrow formatting pane introduces the risk of losing your work if the page times out or refreshes. WPS Office provides an excellent desktop environment to draft, format, and securely store your custom JSON formatting scripts before deploying them to Microsoft 365.

You can open WPS Writer to draft your JSON code cleanly. A crucial step when drafting code in a word processor is ensuring your punctuation remains code-compatible; you can easily disable "Smart Quotes" in WPS Writer's options so your quotation marks do not corrupt the JSON syntax when pasted into SharePoint. Additionally, you can utilize WPS Spreadsheet to build a tracking matrix of your SharePoint lists, documenting which internal column names correspond to your various group formatting scripts. If you manage complex logic, the AI writing tools integrated into WPS Office can help you generate readable documentation or comment blocks explaining your JSON structure. Keeping a local repository of your configurations in WPS Office helps ensure your custom list view setups remain safe, editable, and easy to share with other administrators.

WPS Writer app icon
WPS Presentation app icon
WPS Spreadsheets app icon
WPS PDF app icon
Use Word, Excel, and PPT for FREE

FAQs

What is the difference between @group.fieldData and @group.columnDisplayName?

When you reference @group.fieldData in SharePoint List View JSON, you are extracting the actual recorded value of the data inside the column (for example, "Marketing" or "Completed"). In contrast, @group.columnDisplayName retrieves the title of the column itself (for example, "Department" or "Task Status"). Developers typically concatenate both properties to create descriptive headers, such as "Department: Marketing".

Why is my group header returning undefined or rendering blank?

This error occurs because you are calling the data object itself rather than its readable properties. Because the field data is a complex object within the SharePoint architecture, the browser cannot render it directly as plain text. You must append .displayValue to the end of your syntax, formatted exactly as =@group.fieldData.displayValue, to extract the readable string for the user interface.

Does this reference work for secondary sub-groupings in a list?

Yes, SharePoint view formatting supports multiple levels of grouping simultaneously. The @group object dynamically adapts to the current grouping level being rendered by the formatter. When you apply your JSON schema to the view, the same syntax will correctly output the specific field data for both the primary group headers and any nested secondary group headers without requiring separate logic.

How do I combine the field data string with the total item count?

To display both the category name and the number of items it contains, you must use string concatenation within the txtContent property. You combine the field data reference with the built-in count reference by typing ="=' + @group.fieldData.displayValue + ' (' + @group.count + ')'". This specific configuration dynamically renders a comprehensive header, such as "Marketing (12)", directly in your list view.

Chanuka Geekiyanage

With over 13 years of hands-on experience in office software and tech, I help users navigate the digital world with ease. From mastering Excel to exploring cutting-edge productivity tools, I break down complex features into simple, actionable steps.