0

Good day,

I have a project and a very tight deadline. I have developed a tool for managing events. The system was developed in SharePoint 2010 which was migrated to 2016. I used a calculated column, set it to number and added the following to create an HTML Link for my query string filter:

=<a href='/sites/site/Pages/ManageMission.aspx?MissionID='>Manage Mission</a>

The above created a link that navigated to a page with a query string filter and everything worked great. My platform provider upgraded to SharePoint 2016 where calculated columns can no longer render HTML/Javascript code as they used to as of 2017. Through a few days of research, I cannot find a viable solution due to the following.

-SharePoint Column Formatting is not available until O365.

-SharePoint 2007 had an old way of doing this, all solution examples do not appear to work

-SharePoint 2016 does not support the calculated column trick as 2013 did

-I have tried JSLink, however I have no knowledge of how to write in this

I find myself in the middle of multiple platforms and no viable solution. Does anyone have a solution example for this? I simply need a way to concatenate a URL with the value of MissionID Column and click on it to go to my filtered page.

R/ Cory

  • Have you tried returning this calculated column as Number? check if it working by returning the calculated column as Number or not? – Ganesh Sanap Jul 24 at 13:06
1

You have only one option to use js link.

Below is sample code on js link on converting a field data as hyper link

<script type="text/javascript">  
(function () {  
    // Create an object that have the context information about the fields that we want to change the rendering of.   
    var nameFiledContext = {};  
    nameFiledContext.Templates = {};  
    nameFiledContext.Templates.Fields = {  
        // Apply the new rendering for these fields on List View  
        "Name": { "View": nameFiledTemplate }  
    };  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(nameFiledContext);  
})();  

// This function provides the rendering logic for the list view  
function nameFiledTemplate(ctx) {  
    var name = ctx.CurrentItem.Name;  

    var address = ctx.CurrentItem.Address;   
    if(address == "Hyderabad"){  
        address = "HYD";  
    }  
    else{  
        address = "BAN";  
    }  

    return "<a target='_blank' href='http://www.c-sharpcorner.com/members/ramakrishna-basagalla'>"   
        + name + " - " + address + "</a>";      
}  
</script>  

https://www.c-sharpcorner.com/article/how-to-make-sharepoint-field-data-as-hyper-link-using-js-link/

  • Thank you, I have been able to make this work. – Cory Cox Jul 24 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.