top of page

Continue using SharePoint Calculated HTML Fields with JS Link

Microsoft gave us a surprise on June 13th. You might have had to rely on the helpdesk support tickets coming in to find out that your SharePoint Online environment is no longer rendering your calculated fields that contain embed HTML. We have always known that this was not a 'supported' used of calculated fields, but we have gone ahead and kept rolling the dice and gambling that the dice wouldn't crap out. In other words - Microsoft dropping support for this functionality. It's not even dropping support, it is just disabling this capability.

Now that it has come to pass, there are a couple of options to take. The quickest short term remedy is to call Microsoft and ask them for the 'one time' extension on calculated fields. They had our environment addressed with 24 hours. While I thought I read that it would be extended 90 days, Microsoft support says I have 60 days.

There was one option that came out right away that leverages jQuery to find the right fields, read the contents, then add the HTML. While this did work on the page open, it fell short when using the paging.

The next option is to use JSLink, which many have suggested, but I couldn't find any simple examples. There are many JSLink examples, but many are hard to follow with more code than I want to review. I was able to take a couple of examples and reduce the coding to just the pieces you need to enable your pages to render the HTML code.

Create the JS Link file and Edit the field

Edit the following code to replace 'MyCalcField' with your internal field name. You do not need to change 'View' because this is list 'View' form we are overriding. (You say you have multiple fields? see notes below...)

This is javascript, so remember to put it inside

Save the following code to a file and put on your SharePoint site. I like to save this file to the "Site Assets" library on the site where the list exists. Keeping it on the site makes it easier to find and edit.

Set the JS Link file on the Web Part

**** Important Update 4/11/2018 ****

As of today, in my SPO instance, I started to seeing some pages coming up as calculations again. It appears my "one time extension" mentioned above has been rescinded. As I was testing, I put the script above on the page with using a CEWP (don't forget to add the <script>...</script> tags to the code above if you are doing it this way) instead of in the JS Link entry described below. Low and behold - the page still rendering properly!

What does this mean?! First off, you can skip going to each web part to add this to the JS Link. Secondly, you could just add all the "HTML" calculation fields that are on the page (not just one list) in this one script. (Note that I have not tested this theory but it should work. I know this maybe not as clean but it's a quick fix if you have to address numerous calculated fields in your environment.)

Note: I could not get this (or JS Link) to work with DisplayForm pages if you have added and connected a list within the form (parent-child type of list).

For all the JS deriders, I know, I know... ¯\_(ツ)_/¯


The next step is to add the reference to your file into the JSLink parameter for your web part. If your script file is "Render.js" and you put the file in the Site Assets library, your entry would be:


Make sure to include "~site/" in the front of this string! If you're putting it in the styles folder or masterpages area, you'll need to use "~sitecollection/" and take some additional steps, but I'm not going to cover that here.

You will need to add this to every page where you have a view with this field in it. This is easy enough to do if aren't using it extensively, but I have used it quite extensively so I expect I will be a bit of work.

Number not required!

As you go about updating your web parts, you'll be happy to note that this process will work whether the field is string or numeric. This means that if you have gone ahead and had Microsoft extend your calculated fields for 60 days, you can go ahead and change your calculated fields from "Number" to "Single Line of Text" to easily find and fix your views one list at a time instead of trying to get everything addressed all at once.

Multiple Fields

If you are looking to update multiple fields, you only need to add a comma after the first field end bracket and add your next field.

Multiple Views

Calculations aren't used when entering new items or editing existing items you may need to show the calculated field when you are displaying an item. For this scenario, you could add update the JS Link on the DisplayForm. To do this, you would add a comma after the first function for the field and add the 'DisplayForm' override. You could then refer to the same file in the JS Link.

Not Happy with the change?

Make yourself heard! I don't like to sound like a curmudgeon but I must say I don't like that this functionality away. It was such a cool and easy way to add functionality. Now we have another layer of complexity to get the same functionality. Also, it didn't help that they only told us after they disabled it instead of before. What do you think? Sound off here, or better yet, on Microsoft's site.

Here is the link to the O365 Feedback. Here is the link to SharePoint Online Community. Here is the link to SharePoint Uservoice.



bottom of page