SharePoint List column formatting adding <p class="editor-paragraph"> to JSON link formatting

Menzel, Heather 5 Reputation points
2025-04-04T16:04:47.2233333+00:00

I have a SharePoint list where items are populated through a PowerAutomate from from MS Forms. One of the columns (called Agenda) contains a URL to a PDF (in SharePoint) that is uploaded through Forms.

The Agenda column with the link is formatted as a Multiple Lines of Text, Plain Text.

To make the URL clickable, I've added this JSON formatting to the column:

{

"$schema": "https://developer.microsoft.com/json-schemas/sharepoint/column-formatting.schema.json",

"elmType": "div",

"children": [

{

  "elmType": "a",

  "attributes": {

    "href": "[$Agenda]",

    "target": "_blank" 

  },

  "style": {

    "color": "#0078d4", 

    "text-decoration": "underline"

  },

  "txtContent": "[$Agenda]"

}

]

}

It works with existing list items. However, when new items are added to the list through the PowerAutomate flow, it adds this formatting to the URL:

<p class="editor-paragraph">URL</p>

This formatting makes the URL unclickable.

How do I fix this so that newly added items contain a clickable URL?

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. AllenXu-MSFT 24,941 Reputation points Moderator
    2025-04-08T01:56:02.9266667+00:00

    Hi @Menzel, Heather,

    To resolve the issue where new items added via PowerAutomate include unwanted HTML tags in the URL, modify your JSON column formatting to strip out the <p> tags using string replacement. Here's the corrected JSON:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sharepoint/column-formatting.schema.json",
      "elmType": "div",
      "children": [
        {
          "elmType": "a",
          "attributes": {
            "href": "=replace(replace([$Agenda], '<p class=\"editor-paragraph\">', ''), '</p>', '')",
            "target": "_blank"
          },
          "style": {
            "color": "#0078d4",
            "text-decoration": "underline"
          },
          "txtContent": "=replace(replace([$Agenda], '<p class=\"editor-paragraph\">', ''), '</p>', '')"
        }
      ]
    }
    

    Key Changes:

    HTML Tag Removal:

    Use replace() twice in both href and txtContent to remove <p class="editor-paragraph"> and </p> from the URL string.

    Dynamic URL Handling:

    Ensures the URL is clean for both the hyperlink and display text, even when PowerAutomate adds extra HTML formatting.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.