Forum Discussion

Kelly Dungate's avatar
Kelly Dungate
Copper Contributor
Jun 14, 2017

SharePoint Online - calculated column no longer showing as hyperlink

A couple of months back I created a calculated column that was showing a hyperlink and I have just noticed that the calculation no longer works.

 

The formula I used is below, note: I have removed all the site name details.

="<a href='site_url_here/SitePages/DesignReview.aspx?Q1="&Title&"'>"&Title&"</a>"

I used a calculated column and set the data returned from the formula to Number.

 

Previously, it would show the Title column as a hyperlink to page that had a query parameter applied.  Now it shows as below (again url removed):

<a href='/site_url_here/SitePages/DesignReview.aspx?Q1=Non-DPK related'>Non-DPK related</a>

 

Has anything change recently in SharePoint Online that is causing this to occur?

 

 

15 Replies

  • Raffaeu's avatar
    Raffaeu
    Copper Contributor

    Kelly Dungate with SharePoint online or SharePoint 2019 is not needed because you can format a column as following:

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "a",
    "txtContent": "@currentField",
    "attributes": {
    "target": "_blank",
    "href": "=@currentField"
    }
    }

  • mgable_presidio's avatar
    mgable_presidio
    Copper Contributor

    Here is the official fix, at least for on-premise:

     

    # NOTE:  =$False  NOT  ="$False"
    # In SharePoint 2016 Management Shell, run...
    
    $Web = Get-SPWebApplication http://weburl
    $Val=$Web.CustomMarkupInCalculatedFieldDisabled=$False
    $web.update()
    
    # To confirm it is now false...
    
    $Web.CustomMarkupInCalculatedFieldDisabled
    • Stefan Klute's avatar
      Stefan Klute
      Copper Contributor

      I love OnPremise! There are so many configurations where I need Powershell, and here *tada* another good example. Thank you very much. This Option Needs to be set to false (CustomMarkupInCalculatedFieldDisabled) now the Hyperlink calculated columns work perfectly again (with datatype number).

      I used the following script:

      cls

      Add-PSSnapin Microsoft.SharePoint.Powershell

      $Web = Get-SPWebApplication https://intranet... #Your Intranet URL

      $Web.CustomMarkupInCalculatedFieldDisabled=$False

      $web.update()

  • Using js-link to fix the problem. No need to change the calculated field. Here's what I came up with: 

     

    function RenderMyCalculatedField() {
    var template = {
    renderMyField: function (ctx) {
    var html = [];
    html.push(ctx.CurrentItem.Skicka); // Fieldname 'Skicka'
    return html.join('');
    }
    }
    function registerTemplate() {
    var context:any = {};
    context.Templates = {};
    context.Templates.Fields = {'Skicka':{'View': template.renderMyField}}; // Fieldname 'Skicka'
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(context);
    }
    registerTemplate();
    };
    RenderMyCalculatedField();
      • Deleted's avatar
        Deleted

        You can use following code in JS Link to fix this issue:

         

        (function () {

        var priorityFiledContext = {};
        priorityFiledContext.Templates = {};
        priorityFiledContext.Templates.Fields = {

        'URL': { 'View' : setURL},

        };
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides(priorityFiledContext);

        })();

        function setURL(ctx){
        var ret="";
        if(ctx.CurrentItem["URL"] != "")
        {
        ret = "<a href=\""+ctx.CurrentItem["URL"]+"\" target=\"_blank\" class=\"lnkURL\">"+ctx.CurrentItem["Title"]+"</a>";
        }
        return ret;
        }

  • We are also facing the same issue.The formula column is displaying plaintext value instead of hyperlink HTML. This was working till tuesday but from yesterday it has suddenly changed. We are working on Office 365 Sharepoint online site. Does any updates implemented by microsoft?

  • This is crazy. I'll have to create JS link templates for a whole bunch of lists if they don't rollback. Are Microsoft going to pay me for this? wtf

    • Brent Ellis's avatar
      Brent Ellis
      Silver Contributor
      The death of the regular "Pro" user and the requirement of being a legit developer continues....
  • Karl Øgaard's avatar
    Karl Øgaard
    Copper Contributor

    Jupp, this is totally frustrating. We are using calculated columns to buil useful links and now they are broken. 

     

    I find it strange that MS did this change so fast with minimal warning. I would guess a lot of people use custom markup in calculated fields. 

     

    So what if it's not supported, it is highly used so insted of blocking it, they should work on a cool solution to replace it and suprise us insted :-) 

  • Yes, unfortunatelly MS has done it again: https://support.microsoft.com/en-us/help/4032106/handling-html-markup-in-sharepoint-calculated-fields

     

    The change has rolled out the same day the news about it was published :(

     

    Although there should be a possibility to request an extension through September 10, 2017. I have no ide how to request it... :D

    • Adri Dijk, van's avatar
      Adri Dijk, van
      Brass Contributor

      Here also a load of sites broken without any communication up front, hopefully Microsoft is going to roll-back this change.

      • Adri Dijk, van's avatar
        Adri Dijk, van
        Brass Contributor

        Still no response to our support call while this is a blocking issue for us, many of our sites are broken. No idea what they are thinking. 

Resources