Microsoft have recently announced that the ability to use HTML markup in SharePoint calculated fields will no longer be available.

“We are changing calculated fields to escape special characters. In some circumstances, this mean that calculated fields that contain any unsupported markup will not display any value. Instead, they’ll be blank in the list view.”

This took place with immediate effect on the 13th June 2017 which caused mass outrage in the SharePoint community simply because it broke a number of ingenious solutions leveraging HTML markup in SharePoint calculated fields.

One of our clients leveraged this feature for dashboard purposes, and it really did work exceptionally well, it was a clean slick low code solution, just the kind we like here at GTconsult.  On the morning of the 14th June 2017 this business critical solution broke down and everyone hit the panic button!  Luckily we have some of the greatest SharePoint minds in our A-Team, and they managed to figure out a workaround.  We thought it best we share this with the community in this time of absolute pandemonium.

The below JavaScript code basically checks TD tags for any divs and then renders them as HTML.  Simply embed this into the page that leveraged HTML markup in calculated fields and the panic should fade away as your HTML renders.  If not tweak the script where needed.

*$(document).ready(function() {

var theTDs = document.getElementsByTagName(“td”);

var i=0;

var TDContent = ” “;

while (i < theTDs.length) {

try {

TDContent = theTDs[i].innerText || theTDs[i].textContent;

if ((TDContent.indexOf(“<div”) == 0) && (TDContent.indexOf(“