How to Create Column Formatting with Custom Hyperlink to another List based on a Lookup Column

In this post I’m going to show you how you can create a hyperlink column in a list that customized with Column Formatting feature and will filter another list items based on a lookup column value.

This scenario was a request from my colleague, and I decided to share it with you :

  • We have two SharePoint lists; one is Projects list and the other one is Milestones.
  • In both lists there is a Project Name column that is a Lookup column and gets its information from another list (Projects Information).
  • The request is to have a column in Projects list with a link to Milestones list and show the Milestones of each project.

To implement this, I created a hyperlink column named ProjectMilestones in Projects list and used Column Formatting feature to customize it as follows :

    "$schema": "",
    "elmType": "div",
    "style": {
        "display": "flex",
        "flex-direction": "row"
      "attributes": {
        "class": "ms-fontSize-xxl"
    "children": [
        "elmType": "a",
        "style": {
          "display": "block",
          "width": "100%",        
          "font-weight": "Normal",
          "font-size": "20px",
          "text-decoration": "none"
        "txtContent":"  Milestones",
        "attributes": {
          "iconName": "FavoriteList",
          "class": "ms-fontColor-themePrimary",
          "target": "_blank",
          "href": "='' + [$Project_x0020_Name_x0020_ x0028_Master.lookupValue]"

In the code above, the FilterField1 and FilterValue1 will filter the list items in Milestones list based on the project name in Projects list.

After applying column formatting on ProjectMilestones column, the result should be something like this :

Now, when the user clicks on the Milestones link, a new tab will open in the browser and Filter items in Milestones list based on the Project Name column value.

The page URL will be something like this :

The important thing in the JSON column formatting code is handling the Lookup column value. As you may know the Lookup columns have two properties available in column formatting:

  • .lookupValue
  • .lookupId

I used the .lookupValue property in “href” attribute in JSON code to get the Project Name column value which is a Lookup column in current list (Projects).

Leave a Comment