"Mastering SharePoint: JSON Formatting for Lookup Columns"

Leveraging JSON Formatting for SharePoint Lookup Columns

In the dynamic world of SharePoint, lookup columns play a pivotal role in maintaining data consistency and integrity. While SharePoint offers a range of out-of-the-box features, sometimes you might need to go beyond the basics to achieve the desired look and feel. This is where JSON formatting comes into play, offering a powerful tool to customize and enhance your SharePoint lookup columns.

Understanding JSON Formatting in SharePoint

JSON (JavaScript Object Notation) formatting is a way to customize the appearance and behavior of SharePoint list views, including lookup columns. It allows you to apply styles, add conditional formatting, and even create custom views. By leveraging JSON formatting, you can transform your SharePoint lists from plain and simple to engaging and informative.

Why Use JSON Formatting for Lookup Columns?

  • Improved Readability: JSON formatting enables you to change the text color, font size, and background color of lookup columns, making them more readable and visually appealing.
  • Conditional Formatting: You can apply conditional formatting to lookup columns to highlight important information or draw attention to specific items.
  • Custom Icons: JSON formatting allows you to add custom icons to lookup columns, providing a quick visual reference for users.
  • Responsive Design: With JSON formatting, you can ensure that your lookup columns display well on various devices and screen sizes.

Getting Started with JSON Formatting for Lookup Columns

To begin using JSON formatting for SharePoint lookup columns, you'll first need to enable the "Modern Experience" for your SharePoint site. Once enabled, you can start applying JSON formatting to your lookup columns. Here's a step-by-step guide to help you get started:

How to Create a Lookup Column in SharePoint
How to Create a Lookup Column in SharePoint

  1. Navigate to the list or library containing the lookup column you want to format.
  2. Click on the "Settings" gear icon and select "List settings" or "Library settings".
  3. Under the "Columns" section, click on the name of the lookup column you want to format.
  4. Scroll down to the "Formatting" section and click on the "JSON formatting" link.
  5. Here, you can enter your JSON code or use the "JSON formatting snippet" panel to build your formatting rules. You can also use the "JSON formatting preview" panel to see how your changes will look in real-time.
  6. Once you're satisfied with your formatting, click "OK" to save your changes.

JSON Formatting Examples for Lookup Columns

To give you an idea of what's possible with JSON formatting for SharePoint lookup columns, here are a few examples:

Changing Text Color Based on Status

In this example, we'll change the text color of a lookup column based on the status of an item. Here's the JSON code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "span",
  "txtContent": "@currentField",
  "style": {
    "color": "=if(@currentField == 'Completed', 'green', if(@currentField == 'In Progress', 'orange', 'red'))"
  }
}

Adding Custom Icons to a Lookup Column

In this example, we'll add custom icons to a lookup column based on the type of an item. Here's the JSON code:

SharePoint List JSON Form Formatting & Validations (3)
SharePoint List JSON Form Formatting & Validations (3)

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "span",
  "attributes": {
    "iconName": "=if(@currentField == 'Type A', 'A', if(@currentField == 'Type B', 'B', 'C'))"
  },
  "style": {
    "padding-right": "5px"
  }
}

Conclusion

JSON formatting offers a wealth of possibilities for customizing and enhancing your SharePoint lookup columns. By leveraging JSON formatting, you can create more engaging and informative lists that cater to the unique needs of your organization. Whether you're looking to improve readability, apply conditional formatting, or add custom icons, JSON formatting has you covered. So why not give it a try and see what you can achieve with your SharePoint lookup columns?

Customize SharePoint Forms with JSON
Customize SharePoint Forms with JSON
a man in a baseball cap is talking to someone on the computer screen that says sharepoint saturday lists, libraies, lookup columns and dynamic filtering
a man in a baseball cap is talking to someone on the computer screen that says sharepoint saturday lists, libraies, lookup columns and dynamic filtering
Different Types of Columns in a SharePoint List and Library
Different Types of Columns in a SharePoint List and Library
Display SharePoint List Items in a SPFX Web Part [Tabular Format]
Display SharePoint List Items in a SPFX Web Part [Tabular Format]
4 Ways to organize documents in SharePoint | SharePoint Maven
4 Ways to organize documents in SharePoint | SharePoint Maven
How to Do Column Validation in SharePoint
How to Do Column Validation in SharePoint
SharePoint Page Section Templates Explained
SharePoint Page Section Templates Explained
Connect SharePoint List To Excel - Part 2
Connect SharePoint List To Excel - Part 2
SharePoint for Beginners: A complete guide to getting started
SharePoint for Beginners: A complete guide to getting started
Add Conditional Formatting to a SharePoint Online List
Add Conditional Formatting to a SharePoint Online List
SharePoint Pages Design Best Practices
SharePoint Pages Design Best Practices
How to Add Custom Metadata Columns to the Filters Pane in SharePoint Online
How to Add Custom Metadata Columns to the Filters Pane in SharePoint Online
an info sheet with the words vlookup and indirects in green letters
an info sheet with the words vlookup and indirects in green letters
3 Ways to Display Related Documents in SharePoint
3 Ways to Display Related Documents in SharePoint
the steps to managing permisions info sheet is shown in blue and pink colors
the steps to managing permisions info sheet is shown in blue and pink colors
Connect A SharePoint List To Excel - Part 2
Connect A SharePoint List To Excel - Part 2
How to Link Excel Workbooks in SharePoint Online
How to Link Excel Workbooks in SharePoint Online
How to Find the Correct Crawled Property for Your SharePoint Column
How to Find the Correct Crawled Property for Your SharePoint Column
How to Create a Custom Permission Level in SharePoint
How to Create a Custom Permission Level in SharePoint
Site Collections, Sites, Pages, Document Libraries, and Folders - putting it all together | SharePoint Maven
Site Collections, Sites, Pages, Document Libraries, and Folders - putting it all together | SharePoint Maven
How to Track Viewers of Files and Pages in SharePoint Online
How to Track Viewers of Files and Pages in SharePoint Online
4 types of document libraries in SharePoint | SharePoint Maven
4 types of document libraries in SharePoint | SharePoint Maven
How to Enable Multiple Metadata Values in SharePoint Columns
How to Enable Multiple Metadata Values in SharePoint Columns
Stop Fighting VLOOKUP: Use XLOOKUP in Excel
Stop Fighting VLOOKUP: Use XLOOKUP in Excel