Forum Discussion
SharePoint Online - calculated column no longer showing as hyperlink
Using js-link to fix the problem. No need to change the calculated field. Here's what I came up with:
- Chris McNultyJun 15, 2017Silver Contributor
Please see our update at https://techcommunity.microsoft.com/t5/SharePoint/Custom-markup-in-SharePoint-calculated-columns/m-p/78225
Thanks.
- DeletedJun 16, 2017
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;
}- Kelly DungateJun 18, 2017Copper Contributor
thank you Vishal! I managed to get this one working.