Share via

Calculated Fields on SharePoint Lists generating HTML

Anonymous
2017-04-20T03:40:05+00:00

Hi,

I developed a bunch of Lists in SharePoint when Classic SharePoint was the only one.  I needed to have some columns in the list be rendered out as HTML (for links and images), and I was able to do this by creating a Calculated Field and setting the data type to be a Number, but now with the latest version of SharePoint Online these fields are getting escaped, and is just showing the HTML code, instead of rendering the HTML.  I have to click the Return to classic SharePoint link (and so does everyone else who uses these lists) in order to view the Hyperlink or the Image that the list is trying to display.

So I was wondering how do you do this in the New SharePoint Online?  Or do you guys plan to add a HTML data type or something?  I just need to be able to render out a text string and not have the string escaped.

For example this is one of these field's calculations, this will show a green tick if the Yes/No field is set to Yes, and red cross if it is set to No.  This is done because the "Yes"/"No" text strings do not look different enough, and you can't see everything at a glance.

=IF([Yes/No Field],"<img src='/SiteAssets/green-tick.png' width='16px' height='16px' />","<img src='/SiteAssets/red-cross.png' width='16px' height='16px' />")

Thanks,

Martin

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-06-16T11:56:44+00:00

Hi Martin,

The Document library will work properly and won't be removed. We removed an undocumented, unsupported behavior that allowed custom markup script inside calculated fields. 

Moreover, some useful links to JSLink and CustomAction documentation are provided at the end of the KB artilce:

For the changes to the calculated columns, please refer to the detailed explanations in the following thread, you may subscribe to it and get the latest update.

Custom markup in SharePoint calculated columns

Regards,

Felix

Was this answer helpful?

0 comments No comments

16 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-04-24T05:58:50+00:00

    Thanks Felix,

    Appreciate you guys looking into it.

    Regards,

    Martin

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-04-24T05:51:37+00:00

    Hi Martin,

    This issue has been submitted to our relevant team for further investigation. You will be contacted via your provided email for further troubleshooting. We will also share the solution to the community once you have confirmed that this issue has been resolved. Community members will be benefited from the outcome of this case.

    Regards,

    Felix

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-04-20T23:25:58+00:00

    This sounds like a typical result of pushing an untested and incomplete update on production sites - we are Msft's beta testers. Msft is so desperate to try and stay relevant, their approach with the "new" experience has been to push it out and react later to problems. Unfortunately this is forcing many companies to look for alternatives and forcing Msft's competitors to ramp up their game. Hopefully, that will be good for users.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2017-04-20T07:24:08+00:00

    Hi Martin,

    Based on your description, we’d like to collect some information through Private Message so that we can check it from the backend.

    1. Please provide the screenshot of the symptom. You can capture screenshots in both classic and new experience SharePoint library.
    2. Please provide the library URL through private message. Meanwhile, do all libraries have the same problem? How about the newly created library?
    3. We would like to collect the tenant information as we may need to engage with our related team to further work with you on the case. You can provide the information in private message.

    Regards,

    Tisky

    Was this answer helpful?

    0 comments No comments